Validating text field based on the combination of alphabets and special characters

Hi Everyone,
I am Using Oracle Apex 4.2 Version . I want to do validation for a textbox where it should accept all alphabets,numbers and special characters (abc12#$ , zbc, 123, nd12, 23_6!, @%77).
But it should NOT accept all special characters only.(@#$#!)
Pelase do help if any knows this.
Thanks in advance,
Nikhil.

Hi Nikhil,
Here is one way that could work.
CREATE TABLE t (x VARCHAR2 (30));
INSERT ALL
INTO t
VALUES ('XYZ123')
INTO t
VALUES ('XYZ 123')
INTO t
VALUES ('xyz 123')
INTO t
VALUES ('X1Y2Z3')
INTO t
VALUES ('123123')
INTO t
VALUES ('abc12#$')
INTO t
VALUES ('@%77')
INTO t
VALUES ('!@#$')
INTO t
VALUES ('~%^&*()_+')
INTO t
VALUES ('23_6!')
INTO t
VALUES ('zbc')
INTO t
VALUES ('123*456')
SELECT * FROM DUAL;
SELECT x
FROM   t
WHERE  ( Regexp_like (x, '[[:alpha:]]') -- include alpha characters
          OR Regexp_like (x, '[[:digit:]]') -- include numbers
          OR Regexp_like (x, '[[:punct:]]') ) -- include special character
       AND ( Regexp_like (x, '^[^%]*$');
             AND Regexp_like (x, '^[^*]*$') ) -- exlude special characters % and *
Jeff

Similar Messages

  • Validating text field based on 2 other fields.

    I've tried a string of if/else but somewhere I am missiing something.
    I've assigned variables to my fields and I will use them here.
    vdd1 = a dropdown with 5 options, " ", "Breakfast", "Lunch" "Dinner" and "Snack"
    vMad1 = A text field into which the user enters a dollar amount
    var vdd1 = this.getField("DropDown1").value;
    var vMar1 = this.getField("MealsAmountRow1").value;
    Here is what I need in English.
    If (vdd1 = "Breakfast") and (vMad > 25) then app.alert("NOTE: The amount you have entered exceeds the $25.00 per day breakfast limit.  Please reduce the amount to $25.00", 3)
    If (vdd1 = "Lunch") and (vMad > 35) then app.alert("NOTE: The amount you have entered exceeds the $35.00 per day lunch limit.  Please reduce the amount to $35.00", 3)
    If (vdd1 = "Dinner") and (vMad > 65) then app.alert("NOTE: The amount you have entered exceeds the $65.00 per day dinner limit.  Please reduce the amount to $65.00", 3)
    If (vdd1 = "Snack") and (vMad > 25) then app.alert("NOTE: The amount you have entered exceeds the $25.00 per day snack limit.  Please reduce the amount to $25.00", 3)

    You've almost got it. Try this:
    var vdd1 = getField("DropDown1").value;
    var vMad1 = +getField("MealsAmountRow1").value;
    if (vdd1 === "Breakfast" && vMad1 > 25) {
        app.alert("NOTE: The amount you have entered exceeds the $25.00 per day breakfast limit.  Please reduce the amount to $25.00", 3);
    } else if (vdd1 === "Lunch" && vMad1 > 35 {
        app.alert("NOTE: The amount you have entered exceeds the $35.00 per day lunch limit.  Please reduce the amount to $35.00", 3);
    } else if (vdd1 = "Dinner" &&  vMad1 > 65) {
        app.alert("NOTE: The amount you have entered exceeds the $65.00 per day dinner limit.  Please reduce the amount to $65.00", 3);
    } else if (vdd1 = "Snack" && vMad1 > 25) {
        app.alert("NOTE: The amount you have entered exceeds the $25.00 per day snack limit.  Please reduce the amount to $25.00", 3);
    The biggest problem is it's not clear when you want this code to be triggered. Where do you currently have it placed?

  • Populate text field based on the lov selected value

    Hi,
    based on the value selected in lov, i want to populate another text field. Below is the code I have written
    In PFR:
    if(pageContext.isLovEvent())
    String lovInputSourceId = pageContext.getParameter(SOURCE_PARAM);
    if ("lovCategory".equals(lovInputSourceId))
    java.util.Hashtable lovResults = pageContext.getLovResultsFromSession(lovInputSourceId);
    if(lovResults!=null)
    String value =(String)lovResults.get("lovCategory");
    amobj.categorycode(value);
    AMImpl code:
    public void categorycode(String code) {
    sundryCodeVOImpl vobj = getsundryCodeVO1();
    vobj.setWhereClause( "lookup_code = "+"'"+code+"'");
    vobj.reset();
    vobj.executeQuery();
    String desc = vobj.first().getAttribute("Description").toString();
    String attr = vobj.first().getAttribute("Attribute1").toString();
    testEOViewImpl vobj1 = gettestEOView1();
    vobj1.getCurrentRow().setAttribute("CodeDescription",desc);
    vobj1.getCurrentRow().setAttribute("PurchasingCategoryCd",attr);
    vobj1.executeQuery();
    With this code, the updated values for the attributes CodeDescription, PurchasingCategoryCd are getting inserted into the database table but they are now showing up in the text fields when a value is selected in lov.
    Please tell me what is the mistake I'm doing.
    Thanks
    Sunny

    I'm using Lov Map to populate the lov field say field A. But I need to populate another field say field B based on the value selected in field A.
    to give an example of my requirement. Consider a view object having attributes col1,col2,col3 and having following data.
    col1--col2--col3
    1-----a-------x
    2-----b------y
    3-----c------z
    I 'll populate the lov of field A with values in col1. when user selects value 1 in field A. automatically field B should show value 'a'. If user selects value 2 in field A, field B should show value 'b' so on.
    Thanks
    Sunny

  • Limit the amount of characters of a text field based on first digit

    Hello and thanks in advance for your help!
    I would like to limit the amount of characters of the text field based on the first digit of the number (the text field is only limited to a number format...no decimals, no commas).
    For example, if the number begins with a 3, I would like to limit the text field to allow only ten characters. I have three scenarios but if I could get started with some code and what is the best place to add it (keystroke or validation?) I can take it from there. Thanks again for your help!!

    I've written this code for you that does that. Use it as the field's custom Keystroke code:
    // Validate that only digits are entered
    if (event.change) {
        event.rc = /^\d+$/.test(event.change);
    // Validate string length if it starts with 3
    if (/^3/.test(AFMergeChange(event))) {
        event.rc = AFMergeChange(event).length <= 10;
        if (!event.rc) app.alert("If the number starts with \"3\" it may not be longer than 10 digits.",1); // optional error message
    You can duplicate the second part of it for additional conditions, but keep in mind that this code won't even let you remove the first character in the field if the result is an invalid one.
    For example, if you enter "234567890123456" then you can't remove the "2" at the start because that would result in an invalid number. You can remove any of the other digits, though, and when it's 10 digits or less then you could remove the starting "2" as well.

  • Where is Hint Box for Validation Text Field widget?

    I want to enter a hint for my form.
    I am following the instructions on the Adobe Using Dreamweaver CS4 page for Insert and edit the Validation Text Field widget page:
    <http://help.adobe.com/en_US/Dreamweaver/10.0_Using/WSEB5440BC-453A-4101-928C-302199E7E02F. html#WS8E6EA74E-87AC-4a81-A5CC-2DB6FB451DE0a>
    It says:
    Create a hint for a text field
    Because there are so many different kinds of formats for text fields, it is helpful to give your users a hint as to what format they need to enter. For example, a text field set with the Phone Number validation type will only accept phone numbers in the form (000) 000-0000. You can enter these sample numbers as a hint so that the text field displays the correct format when the user loads the page in a browser.
       1. Select a Validation Text Field widget in the Document window.
       2. In the Property inspector (Window > Properties), enter a hint in the Hint text box.
    However, the is no hint box in my Propeties area.
    How do I get this hint box to show up?
    Dreamweaver CS4, Windows Vista

    Hi David,
    My Property inspector looks different than what you have below.
    I do not have a Hint box and I do not have the Customize this widget.
    I did have a Hint box and the Customize this widget for CS3, howver not for CS4
    Alison

  • Can I shrink the size of a form text box based on the content?

    We are helping a customer migrate from some MS Word forms to use pdf forms.  We are screenscraping the data from an AS400 green screen system and populating these new pdf forms with data.  however some of the text boxes are in the middle of a sentence and the text box needs to be large enough to fit 50 characters but there are many times when the data we are entering is much less than 50.  The resulting document looks very strange with all of that extra white space in the middle of a sentence due to the size of the text box.
    So can we somehow shrink the size of the text box to fit the number of characters in the box?
    I considered making the box smaller and setting the font size to auto but I think that would look even more strange to have a word with smaller font in the middle of a sentence.
    Thanks,
    Trent

    Sorry, I should have mentioned I am using acrobat professional 9.  I see that I can change the size of the text field when I am designing the form but what I don't see is how to dynamically change the size of the text field based on what data is put inside it.
    Thanks,

  • Spry validation text field across two columns in a table?

    I have a table with two columns.  I can easily insert a spry validated text field into the left cell but when I drag the box over so that box is in the right column and the label is still in the left column then that breaks the widget.
    Is this even possible for me to do or do I have to put the widget in just one column?

    Think I figured it out.
    http://www.adobe.com/devnet/dreamweaver/articles/spry_form_validations.html

  • Using JavaScript to set value of Spry validated text field

    Why can't the value of a text field be set using JavaScript
    when it's validated using the Spry validation widget.
    Example (this works):
    <select name="birthdate_month" id="birthdate_month"
    onChange="document.getElementById('birthdate').value = 'test';">
    <option>1</option>
    <option>2</option>
    </select>
    <input type="text" name="birthdate" id="birthdate"
    value="">
    Example (this doesnt work):
    <select name="birthdate_month" id="birthdate_month"
    onChange="document.getElementById('birthdate').value = 'test';">
    <option>1</option>
    <option>2</option>
    </select>
    <span id="birthdate">
    <input type="text" name="birthdate" id="birthdate"
    value="">
    <span class="textfieldRequiredMsg">please enter your
    birthday</span>
    </span>
    <script type="text/javascript">
    <!--
    var birthdate = new
    Spry.Widget.ValidationTextField("birthdate", "none");
    //-->
    </script>
    Is there a way to change the value of a Spry validated text
    field using JavaScript?
    Thanks.

    Why can't the value of a text field be set using JavaScript
    when it's validated using the Spry validation widget.
    Example (this works):
    <select name="birthdate_month" id="birthdate_month"
    onChange="document.getElementById('birthdate').value = 'test';">
    <option>1</option>
    <option>2</option>
    </select>
    <input type="text" name="birthdate" id="birthdate"
    value="">
    Example (this doesnt work):
    <select name="birthdate_month" id="birthdate_month"
    onChange="document.getElementById('birthdate').value = 'test';">
    <option>1</option>
    <option>2</option>
    </select>
    <span id="birthdate">
    <input type="text" name="birthdate" id="birthdate"
    value="">
    <span class="textfieldRequiredMsg">please enter your
    birthday</span>
    </span>
    <script type="text/javascript">
    <!--
    var birthdate = new
    Spry.Widget.ValidationTextField("birthdate", "none");
    //-->
    </script>
    Is there a way to change the value of a Spry validated text
    field using JavaScript?
    Thanks.

  • Spry validation text field issue

    I've put several spry validation text fields on my site and
    you can still click through to the next page without having to
    enter any information. What am I missing?

    Think I figured it out.
    http://www.adobe.com/devnet/dreamweaver/articles/spry_form_validations.html

  • Text field properties-Using the 'required' option in the text field properties.

    Using the required' option in the text field properties.
    The 'help' manual describes the 'required' function as this: Required Forces the user to fill in the selected form field. If the user attempts to submit the form while a required field is blank, an error message appears and the empty required form field is highlighted.
    My users ARE not submitting the form, they open the pdf, fill it out and print it. HOW can I, make a field "required', I don't want them to skip/leave blank specific fields. However, if I choose the box 'required' in the text field properties, and I begin filling out the form, I can just tab past that field that I've choose as 'required', and I do not get
    prompt/error message or anything, it allows me to save, or print.
    I WANT SOME TYPE OF message (similar to enter a company order form
    off the web, where you can't continue without filling out 'required' fields).
    Is there a step/option I am not doing?

    Then you are going to have to write some JavaScirpt to be executed by the "Will Print" document action to check all the requried fields, either by name or by the 'required' property and handle the issue of the imcomplete fields. You will not be able to stop the print, but you could display and error field so the user knows the form is incomplete and the printed form also conatains this information.

  • How to enable/disable the input fields based on the data entered/user action in the web dynpro abap?

    How to enable/disable the input fields based on the data entered in the web dynpro application abap?  If the user enters data in one input field then only the next input field should be enabled else it should be in disabled state. Please guide.

    Hi,
    Try this code.
    First create a attribute with the name readonly of type wdy_boolean and bind it read_only property of input field of which is you want to enable or disable.
    Next go to Init method.
    Set the readonly value as 'X'.
    DATA lo_el_context TYPE REF TO if_wd_context_element.
         DATA ls_context TYPE wd_this->element_context.
         DATA lv_visible TYPE wd_this->element_context-visible.
    *   get element via lead selection
         lo_el_context = wd_context->get_element( ).
    *   @TODO handle not set lead selection
         IF lo_el_context IS INITIAL.
         ENDIF.
    *   @TODO fill attribute
    *   lv_visible = 1.
    *   set single attribute
         lo_el_context->set_attribute(
           name =  `READONLY`
           value = 'X').
    After that Go to the Action  ENTER.
    First read the input field ( first input field, which is value entered field) , next give a condition
    if input value is not initial  then set the readonly value is '  '.
    DATA lo_nd_input TYPE REF TO if_wd_context_node.
         DATA lo_el_input TYPE REF TO if_wd_context_element.
         DATA ls_input TYPE wd_this->element_input.
         DATA lv_vbeln TYPE wd_this->element_input-vbeln.
    *   navigate from <CONTEXT> to <INPUT> via lead selection
         lo_nd_input = wd_context->get_child_node( name = wd_this->wdctx_input ).
    *   @TODO handle non existant child
    *   IF lo_nd_input IS INITIAL.
    *   ENDIF.
    *   get element via lead selection
         lo_el_input = lo_nd_input->get_element( ).
    *   @TODO handle not set lead selection
         IF lo_el_input IS INITIAL.
         ENDIF.
    *   get single attribute
         lo_el_input->get_attribute(
           EXPORTING
             name =  `VBELN`
           IMPORTING
             value = lv_vbeln ).
    if lv_vbeln IS not INITIAL.
        DATA lo_el_context TYPE REF TO if_wd_context_element.
        DATA ls_context TYPE wd_this->element_context.
        DATA lv_visible TYPE wd_this->element_context-visible.
    *  get element via lead selection
        lo_el_context = wd_context->get_element( ).
    *  @TODO handle not set lead selection
        IF lo_el_context IS INITIAL.
        ENDIF.
    *  @TODO fill attribute
    *  lv_visible = 1.
    *  set single attribute
        lo_el_context->set_attribute(
          name =  `READONLY`
          value = ' ' ).

  • Change value of another field based on the value of selectOneRadio

    Hello
    I need to display one of two city fields based on the value of a radio group. If the value of the radio group is "Yes", then display the non mandatory city field, if the value is "No", then display mandatory city field. Please can someone help me? The code is below
    <af:subform id="contactForm3" default="true">
                <af:panelForm binding="#{processScope.backing_regDetails.contactPanel3}">
                  <af:selectOneRadio binding="#{processScope.backing_regDetails.radio1}"
                                     labelAndAccessKey="#{MatrixResource['ContactDetails.inBoroughQuestion']}"
                                     layout="horizontal"
                                     valuePassThru="true"
                                     required="true"
                                     onchange="javascript.refresh;" >
                      <f:selectItems value="#{processScope.backing_regDetails.items}" />
                  </af:selectOneRadio>
                  <af:inputText onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value='0';"
                                labelAndAccessKey="#{MatrixCommon['Label.SAO']}"
                                binding="#{processScope.backing_regDetails.houseNameText}"                           
                                maximumLength="240"/>
                  <af:inputText required="true"
                                onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value=0;"
                                maximumLength="240"
                                label="#{MatrixCommon['Label.PAO']}"
                                binding="#{processScope.backing_regDetails.numberStreetText}"/>
                  <af:inputText onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value='0';"
                                maximumLength="240"
                                labelAndAccessKey="#{MatrixCommon['Label.District']}"
                                binding="#{processScope.backing_regDetails.districtText}"/>
                  <af:inputText maximumLength="60"
                                rendered="#{!backing_regDetails.radio1}"
                                onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value='0';"
                                labelAndAccessKey="#{MatrixCommon['Label.TownCity']}"
                                required="true"
                                binding="#{processScope.backing_regDetails.cityText}"/>
                 <af:inputText maximumLength="60"
                                rendered="#{backing_regDetails.radio1}"
                                onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value='0';"
                                labelAndAccessKey="#{MatrixCommon['Label.TownCity']}"
                                required="false"
                                binding="#{processScope.backing_regDetails.cityText}"/>
                  <af:inputText maximumLength="60"
                                onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value='0';"
                                labelAndAccessKey="#{MatrixCommon['Label.County']}"
                                binding="#{processScope.backing_regDetails.countyText}"/>
                  <af:inputText columns="7"
                                onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value=0;"
                                labelAndAccessKey="#{MatrixCommon['Label.Postcode']}"
                                binding="#{processScope.backing_regDetails.postcodeText}"/>
                  <af:selectOneChoice onchange="javascript:document.forms[0].elements['contactForm3:locationId'].value=0;"
                                      binding="#{processScope.backing_regDetails.countrySelect}"
                                      value="#{processScope.backing_regDetails.enteredAddress.countryId}"
                                      labelAndAccessKey="#{MatrixCommon['Label.Country']}">
                      <f:selectItems value="#{backing_regComponents.countryChoiceList}"/>
                  </af:selectOneChoice>
                  <af:inputHidden value="#{processScope.backing_regDetails.enteredAddress.locationId}"
                                binding="#{processScope.backing_regDetails.locationIdHidden}"
                                id="locationId"/>
                  </af:panelForm>
                  </af:subform>Edited by: aademola on Nov 13, 2008 7:35 AM
    Edited by: aademola on Nov 13, 2008 7:42 AM

    Hi,
    you should be able to apply this example to your 10.1.3 project
    see 4.3.2 of http://download.oracle.com/docs/cd/E12839_01/web.1111/b31973/af_lifecycle.htm#CIAHCFJF
    Frank

  • How to re-size a overflow text frame based on the text length?

    Hi ..
    Is it possible to re-size a overflow text frame based on the text length?

    Hello,
    Please refer to forum post : http://forums.adobe.com/message/4828489#4828489
    Regards,
    Sachin

  • Payment medium - Text fields shifted to the left

    Hello Experts,
    after running the payment run, the payment media is created but the text fields that are written in the files are shifted to the left.
    The files contains 4 text fields. In the first text field should be written the value LS_REF1 and in the second one the value LS_REF3
    If LSREF1 is blanc, then the value of LS_REF3 is written in the first text field.
    Is it possible to avoid that SAP shift the fields to the left? In the function module FKK_PAYM_DEDIUM_WRITE is used the FM FKK_DME_DETAILS_FILL, which shift the values.
    Cheers and thanks in advance
    Edited by: prashak80 on Jul 23, 2010 12:16 PM

    In the respective field properties (double click the field node), goto Attributes tab.  There you'll find a field 'Conv. function'.  Press F4. You'll be presented with many functions.  Scroll down and find functions starting with C.  Select the one that best suits your needs.  This is for maintaining the alignment within the field output.
    If your problem is that REF1 field is skipped when there are no values and that's what is causing the alignment as REF3 is shifted to that extent, then you need REF1 field to output at any cost irrespective of any values are present. In this case, check the status filed in the same tab.  The status field should be blank (standard).
    You can also consider Target offset field.  This will offset as many number of characters in the output field.  You might have to play with these settings.
    Hope this helps.
    Ravi.

  • Validating Text Fields

    Hi All,
        I am very new to the concept of BSP and need your help in one part of my development.
        I have designed a BSP which has some text fields.
    In the last focus (On Blur) of field1 I wanted to check if it contains only numbers, if not I wanted to popup an error message.
           Can anyone help me in this regard.
    Thanks in Advance.
    Regards,

    here is a sample BSP page with one input filed which will only accept numbers 0123456789
    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <%@extension name="bsp" prefix="bsp" %>
    <SCRIPT LANGUAGE="JavaScript">
    function chkNumeric(objName)
    // only allow 0-9 be entered, plus any values passed
    var checkOK = "0123456789";
    var checkStr = objName;
    var allValid = true;
    var decPoints = 0;
    var allNum = "";
    for (i = 0;  i < checkStr.value.length;  i++)
    ch = checkStr.value.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
    if (ch == checkOK.charAt(j))
    break;
    if (j == checkOK.length)
    allValid = false;
    break;
    if (ch != ",")
    allNum += ch;
    if (!allValid)
    alertsay = "Please enter only these values ""
    alertsay = alertsay + checkOK + "" in the "" + checkStr.name + "" field."
    alert(alertsay);
    return (false);
    </script>
    <htmlb:content design="design2003" >
      <htmlb:page title="detail " >
        <htmlb:form>
          <%
    data: tmp_string type string .
      tmp_string = `<input onBlur="javascript:chkNumeric(this);"`.
          %>
          <bsp:findAndReplace find    = "<input"
                              replace = "<%= tmp_string %>" >
            <htmlb:inputField id        = "myInputField2"
                              value     = ""
                              alignment = "left" />
          </bsp:findAndReplace>
       </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    Regards
    Raja

Maybe you are looking for

  • Getting error while adding field to data viewer web part

    I have custom EditItemForm for a custom list having over 100 columns. That EditItemForm contains a DataFormWebPart in edit mode having over 100 <SharePoint:FormField controls. If I browse for the above page in internet explorer, I got got the generic

  • SAP Script: How do you print internal table values in a VAR window?

    Hi   I want to have a window like MAIN window where I can print data like line items and the no of lines are only 3..I have added one window type VAR. I have schedule line data in one internal table in which I am calling WRITE_FORM func.mod for the n

  • Issues with Bookmarks in Adobe Acrobat X Standard

    I am trying to send a combined pdf document to dlients.  The document has bookmarks and I set the document to show those book marks upon opening of the document. When I send the document to the clients, the bookmarks are not showing up. They are bein

  • Why can i not get 3G on my iphone 4

    why can i not get 3G on my iphone 4?

  • Integration between Lightroom and Photoshop broken

    It will almost inevitably turn out that I'm missing something glaringly obvious, but since upgrading to Lightroom 5.5 and Photoshop CC 2014, my photos are losing their LR adjustments when sent to PS. I'm no longer asked how I want the RAW files rende