Script for validating Text fields or numeric fields

I'm looking for a simple script that will check the entered data in a specific field.If i enter numbers in the name/last name field i should get a pop up message that entering numbers in this field are not allowed.
(And vice versa regarding numeric fields).
What is the script for that ?

Hi,
try this:
//var reg = /^\d+$/;    // checks whether input contains ONLY digits
var reg = /\d+/;    // checks whether input contains digits AND letters
var check = reg.exec(xfa.resolveNode("#subform[0].#field[0]").rawValue);
if (check == null)
    app.alert("Everything's fine!");
else
    app.alert("Entering digits is not allowed!");
You may want to replace
#subform[0] with the name of the subform the field to check is located in and
#field[0] with the name of the field to check for digits.
Also, you may want to select any of the regular expressions, which fits best your needs. See comment in the above code-fragement for further information.
Regards,
Steve

Similar Messages

  • 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

  • Spry for validating text fields

    Hi,
    How would I go about using Spry to validate a group of text feilds, I want the viewer to insert text into at least one text feild.
    I'm using CS5
    Thanks in advance

    Have you considered a Selection List?
    <form>
    Select One:
    <select name="Qty">
    <option selected="selected">Qty:</option>
    <option value="5">5</option>
    <option value="10">10</option>
    <option value="25">25</option>
    <option value="50">50</option>
    <option value="100">100</option>
    <option value="500">500</option>
    <option value="1000">1000</option>
    </select>
    </form>
    Nancy O.

  • 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.

  • How to set fixed size for inputfile text field

    Hi all,
    I am using inputfile component to test file uploading so I created a simple upload page. When I finished upload the file, the input text field will "shrink" its size and change the size to adjust the file name. Is there any way to set a fix size for input text field?
    Here is some part of the code:
    <af:form id="f1" usesUpload="true">
    <af:panelHeader text="File Uploader" id="ph1">
    <af:inputFile label="File to upload" id="if1" autoSubmit="true" valueChangeListener="#{fileBean.fileUpdate}"
    value="#{fileBean.file}" partialTriggers="if1"
    columns="50"/>
    </af:panelHeader>
    <af:commandButton text="Save" id="cb1"/>
    FileBean:
    public void fileUpdate(ValueChangeEvent valueChangeEvent) {
    RichInputFile inputFileComponent = (RichInputFile)valueChangeEvent.getComponent();
    UploadedFile newFile = (UploadedFile)valueChangeEvent.getNewValue();
    UploadedFile oldFile = (UploadedFile)valueChangeEvent.getOldValue();
    Thanks,
    Jerry

    you can set columns attribute in af:inputfile. Please see highlighted area i have inserted to you code
    <af:form id="f1" usesUpload="true">
    <af:panelHeader text="File Uploader" id="ph1" columns = "34" >
    <af:inputFile label="File to upload" id="if1" autoSubmit="true" valueChangeListener="#{fileBean.fileUpdate}"
    value="#{fileBean.file}" partialTriggers="if1"
    columns="50"/>
    </af:panelHeader>
    <af:commandButton text="Save" id="cb1"/>

  • InDesign CS6 how to set justification for form text field?

    Hi everyone,
    I've been playing with the ability to create form for PDF file but I haven't figure out how to set a center justification for a text field.  By default it's left.  Same thing for font, the one selected in InDesign while creating the form isn't used when editing the form in Acrobat.
    Do I need to create a paragraph style with a specific name to preserve both attributes?
    Thanks.

    InDesign CS6's forms features are great, but you're looking as version 1.0 of the feature. Those features cannot be set in InDesign.
    Furthermore, if you try to pick a font other than the standard ones at the top of the menu, don't expect that your form users will be able to pick those fonts when they open up the form in Reader or Acrobat. I'm pretty sure that custom fonts are not stored in the PDF form.

  • 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

  • How to give for a text field 'max+1' value instead of sequence .

    HI All,
    I have a requirement like ,
    For my text field i applied sequence by using groovy expression.Now i need to change that to 'max+' value of table Grid and display in the text field. Can please suggest me how can i implement .(JDev 11.1.1.3 v)
    Regards,
    Sindhu.

    hi user,
    if you want perform some increment operation . in auto means. donot prefer these thread given below..
    there is lot thread of for creating sequence. based on the sequence it works perfect.
    if i understud correctly means follow this
    Increment operation // it perfoms some increment operation. not using sequennce.
    button press
    compliation problem // have a look at this
    if cumes under cirumstance for multiple user on that scree or ui . probabaly this idea(max)or (some increment) will fails.
    i i will prefer sequqnecs._
    IN ADDITION INFO TO USER
    JOHN SAYIGN EXACTLY
    Edited by: Erp on Sep 25, 2011 9:46 PM

  • What is the Table name & Field Name for Clearing text field in F-53 Transac

    Hi,
    I need prepare a functional specification for Clearing text field in Check Register.I am not able to find the Table name and Field Name for Clearing text field in F 53 transaction code.Kindly provide me the Table and filed name.so that i can proceed.Kindly help me.
    I will assign points.
    Thanks
    Sunitha

    Hi
    From the payment document you have to link to the clearing document (Number BSEG-AUGBL, same Fiscal year and Company Code) in the clearing document the text entered in the transaction can be found on item text (BSEG-TEXT).
    RF05A is a Structure name
    Ranga
    Edited by: Ranga Swamy on Dec 4, 2008 7:55 PM

  • How to disable auto-complete for a text field?

    I didn't find any attribute that controls this. Thanks!

    Hi,
    Recently I needed to use this feature, and after some research I found the answer.
    Just sharing the solution.
    I am aware that the auto-complete is a browser setting. But is there a way to let APEX not save the items entered before? Write a javascript?
    Because I have implemented Google suggest for a text field. Every time the suggestions pop up, the auto-complete items will also appear at the same time, which is very annoying.Put on your Page Item > Element > HTML Form Element Attributes : autocomplete="off"
    Bytes

  • SAP VB script for updating texts in purchase orders

    Hello,
    I am trying to create a SAP script for updating texts in purchase orders. It is in the last third - Item Detail,  Texts tab.
    The script is ok apart from the fact that it always deletes whatever text is in there and than add a new one.
    I would like to keep history in the texts tab and always just add one line to existing texts. Is there any way (command) how
    to keep existing texts and only add a new line to the top?
    Thanks a lot!
    Jan

    Yes, you are exactly right. I have already figured it out as well. I did not expect it would be that easy. But thanks a lot anyway for replying on this!
    Now I am struggeling with changing SAPLMEGUI in vb scripts for ME22n. Sometimes, there is SAPLMEGUI:0010 and sometimes SAPLMEGUI:0015. Even when the users have the same screens in the beginning the SAPLMEGUI number differs. They also do one item by hand and than it changes. It keeps changing between SAPLMEGUI:0010 and SAPLMEGUI:0015
    Is there a way how to have the same number of SAPLMEGUI or how to eliminate this issue?
    Thanks a lot
    Jan

  • I am in need of ai script for arcing text

    i am in need of ai script for arcing text

    A little vague aren't we… Is this the kind of arcing you mean? Text along a curve or do you mean distorting into an arch like some plug-in can?
    #target illustrator
    var doc = app.activeDocument;
    doc.defaultFilled = false, doc.defaultStroked = true;
    var textPath = doc.pathItems.ellipse( 0, 0, doc.width, doc.height );
    textPath.pathPoints[3].selected = PathPointSelection.ANCHORPOINT;
    app.cut();
    doc.selection = null;
    app.redraw();
    var tp = doc.textFrames.pathText( doc.pathItems[0], 0, 0, TextOrientation.HORIZONTAL );
    tp.textRange.paragraphAttributes.justification = Justification.CENTER;
    tp.textRange.characterAttributes.size = 60;
    tp.contents = 'I am in need of ai script…';
    var tpd = tp.duplicate();
    tpd.translate( 0, -150 );
    tpd.textRange.characterAttributes.size = 90;
    tpd.contents = '…for arcing text?';

  • Possible to change type of spry validation text field at run time?

    I am trying to record a date of death on a form, which obviously for live people might not require a value. I have a radio group (Yes/No) that specifies whether the fields associated with the date of death are visible (select for month, day and year).  For the year, I have it set to be an integer with a minimum and maximum value.  The selects have an invalid value of -1 set, with one item labeled "Select month" and "Select day" given the -1 value.
    When the "no" button is clicked, I want to make it so that submitting the form does not cause validation errors for the spry fields associated with the date of death.  I have successfully added onChange events to the select objects that call javascript, along the lines of spryselect1.invalidValue = -2.  I can also make it so that the text field representing the year of death is not forced to be required: sprytextfield1.isRequired = false.
    However, I'm having a hard time getting the "invalid format" validation to be canceled.  I have tried executing sprytextfield1.type = "none", since looking at the source code in SpryValidationTextField.js seems to indicate that the object's type property is important.  However, this doesn't work; I think that's because the type property is used to look up a validation function in an array when the object is constructed, and may not be referenced again after that.
    So, I'm looking for either:
    a property/method to call to effectively change the type OR
    information on whether reconstructing the variable with new options will work.  I am not sure if any event handlers registered during the object's original construction will still be fired even if I make the variable point to a new object.  I see a destroy function in the source code that might do what I want, but my Javascript knowledge isn't too great, so I don't know if that method needs to be called explicity or whether it happens implicitly when an object is garbage collected.
    Thanks in advance for any help you might be able to give.
    Ryan

    This may help
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Deleting and rebuilding validations</title>
    <link href="http://config.spry-it.com/css?f=ValidationTextField" rel="stylesheet" type="text/css" />
    <script src="http://config.spry-it.com/js?f=ValidationTextField" type="text/javascript"></script>
    <script type="text/javascript">
    // build validations and delete / destroy them
    function val(e){
         // get the value
         value = e.value;
         // see what radion button we have
         if(value == "Married"){
              // if there inst a validaton build one
              if(!sprytextfield1){
                   sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
              // if there is a validaiton in sprytextfield destory it, and clear the variable
              if(sprytextfield2 && sprytextfield2.destroy){
                   sprytextfield2.resetClasses();
                   sprytextfield2.destroy();
                   sprytextfield2 = null;
              // same as the rest
              if(sprytextfield3 && sprytextfield3.destroy){
                   sprytextfield3.resetClasses();
                   sprytextfield3.destroy();
                   sprytextfield3 = null;
         } else if(value == 'Defacto'){
              if(!sprytextfield2){
                   sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
              if(sprytextfield1 && sprytextfield1.destroy){
                   sprytextfield1.resetClasses();
                   sprytextfield1.destroy();
                   sprytextfield1 = null;
              if(sprytextfield3 && sprytextfield3.destroy){
                   sprytextfield3.resetClasses();
                   sprytextfield3.destroy();
                   sprytextfield3 = null;
         } else if(value == 'Single'){
              if(!sprytextfield3){
                   sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
              if(sprytextfield1 && sprytextfield1.destroy){
                   sprytextfield1.resetClasses();
                   sprytextfield1.destroy();
                   sprytextfield1 = null;
              if(sprytextfield2 && sprytextfield2.destroy){
                   sprytextfield2.resetClasses();
                   sprytextfield2.destroy();
                   sprytextfield2 = null;
         // proceed with the rest as normal
         return true;
    </script>
    </head>
    <body>
    <form id="form1" method="post" action="#">
         <p>
              <input type="radio" name="radio" id="Married" value="Married" onclick="val(this);" />
              <label for="Married">Married</label>
         </p>
         <p>
              <input type="radio" name="radio" id="Defacto" value="Defacto" onclick="val(this);" />
              <label for="Defacto">Defacto</label>
         </p>
         <p>
              <input type="radio" name="radio" id="Single" value="Single" onclick="val(this);" />
              <label for="radio">Single</label>
         </p>
         <hr />
         <span id="sprytextfield1">
         <input name="married" id="f_married" type="text" value="forMariedOnly" />
         <span class="textfieldRequiredMsg">A value is required.</span></span><span id="sprytextfield2">
         <input name="defacto" id="f_defacto" type="text" value="forDefactoOnly" />
         <span class="textfieldRequiredMsg">A value is required.</span></span><span id="sprytextfield3">
         <input name="single" id="f_single" type="text" value="forSingleOnly" />
         <span class="textfieldRequiredMsg">A value is required.</span></span>
         <hr />
         <input type="submit" value="Submit" />
    </form>
    <script type="text/javascript">
    <!--
    // as Married is checked by default, we need to validate this field only
    var sprytextfield1,
         sprytextfield2,     // empty global var
         sprytextfield3; // empty global var
    //-->
    </script>
    </body>
    </html>
    Gramps

  • Using regular expressions for validating time fields

    Similar to my problem with converting a big chunk of validation into smaller chunks of functions I am trying to use Regular Expressions to handle the validation of many, many time fields in a flexible working time sheet.
    I have a set of FormCalc scripts to calculate the various values for days, hours and the gain/loss of hours over a four week period. For these scripts to work the time format must be in HH:MM.
    Accessibility guidelines nix any use of message box pop ups so I wanted to get around this by having a hidden/visible field with warning text but can't get it to work.
    So far I have:
    var r = new RegExp(); // Create a new Regular Expression Object
    r.compile ("^[00-99]:\\] + [00-59]");
    var result = r.test(this.rawValue);
    if (result == true){
    true;
    form1.flow.page.parent.part2.part2body.errorMessage.presence = "visible";
    else (result == false){
    false;
    form1.flow.page.parent.part2.part2body.errorMessage.presence = "hidden";
    Any help would be appreciated!

    Date and time fields are tricky because you have to consider the formattedValue versus the rawValue. If I am going to use regular expressions to do validation I find it easier to make them text fields and ignore the time patterns (formattedValue). Something like this works (as far as my very brief testing goes) for 24 hour time where time format is HH:MM.
    // form1.page1.subform1.time_::exit - (JavaScript, client)
    var error = false;
    form1.page1.subform1.errorMsg.rawValue = "";
    if (!(this.isNull)) {
      var time_ = this.rawValue;
      if (time_.length != 5) {
        error = true;
      else {
        var regExp = /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/;
        if (!(regExp.test(time_))) {
          error = true;
    if (error == true) {
      form1.page1.subform1.errorMsg.rawValue = "The time must be in the format HH:MM where HH is 00-23 and MM is 00-59.";
      form1.page1.subform1.errorMsg.presence = "visible";
    Steve

Maybe you are looking for