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?

Similar Messages

  • 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

  • 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

  • Problem with validating text field

    Hi All
    i want to validate the text fields present in jsp page for a sturts application..
    i have a jsp page for input then struts form for validation as struts machinism provides and if error occurs it add error to error object.
    i want to display error message in text field when it occurs..
    plz help me to do it
    thanx in advacne

    I'm not getting your requirement clearly, by my understanding ... you need to retrieve database whenever a <select> field trigger "onchange" - am I right?
    If that is your requirement, it depends on what kind of solution you are looking into?
    1. AJAX+Servlet (dojo/jMaki/write your own)
    2. Java Server Faces (MyFaces/JSF)
    3. write yourself a custom TAG (JSTL) to do the purpose (AJAX+Servlet/purely Servlet)
    4. purely JSTL
    5 purely Servlet
    (please "Google" them by appending "<select> <option>"/ "populate combobox")
    Personally I would recommend 1st or 3rd approach, even 2nd approach (MyFaces/JSF) is cool, but if your whole application is not written in JSF, no point to mixed the solutions.
    If you want to try Ajax+TAG approach, refer following:
    http://ajaxtags.sourceforge.net/
    If you wish to use MyFaces approach, please refer following:
    http://avatar21.superihost.com/index.php?entry=entry051020-163838
    A forth/fifth approach will be much browser-portable, but the amount of coding will be more.
    Regards,
    Avatar Ng
    Message was edited by:
    Avatar_Ng
    Message was edited by:
    Avatar_Ng

  • 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

  • Validating text field

    hey fellows i want to validate text field by restricting user to just enter alphabets e.g (A to Z) and (a to z) and only one space is allowed between name. it stop a user if accidently numaric value is inserted or special character or anything except alphatics .

    Hi try something like this...
    Create this function in your form and call it in WHEN-VALIDATE-ITEM trigger.
    FUNCTION Check_Validation(pWord IN VARCHAR2) RETURN BOOLEAN IS
         vRetVal BOOLEAN;
         vCountSpaces NUMBER:=0;
    BEGIN
         FOR A IN 1..LENGTH(pWord) LOOP
              IF  (ASCII(SUBSTR(pWord,A,1)) NOT BETWEEN 65 AND 90) THEN
                   IF (ASCII(SUBSTR(pWord,A,1)) NOT BETWEEN 97 AND 122) THEN
                        IF (ASCII(SUBSTR(pWord,A,1)) != 32) THEN
                             vRetVal:=FALSE;
                             EXIT;
                        END IF;
                   END IF;
              END IF;
              IF ASCII(SUBSTR(pWord,A,1))=32 THEN
                   vCountSpaces:=vCountSpaces+1;
                   IF vCountSpaces>1 THEN
                        vRetVal:=FALSE;
                        EXIT;
                   END IF;
              END IF;
         END LOOP;
         if vRetVal OR vRetVal IS NULL THEN
              RETURN TRUE;
         ELSE
              RETURN FALSE;
         END IF;
    END;and your WHEN-VALIDATE-ITEM trigger would be like this...
    DECLARE
         vVal BOOLEAN;
    BEGIN
         vVal:=CHECK_VALIDATION(:ti_txt);
         IF vVal=FALSE THEN
              MESSAGE('Invalid Value');
              MESSAGE('Invalid Value');
         ELSE
              MESSAGE('Value Correct');
              MESSAGE('Value Correct');
         END IF;
    END;-Ammad

  • 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

  • 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

  • Having Problems with "pattern" in Spry Validation Text Field

    Hi, thanks for reading. I have read the primers and docs on
    using the "custom" pattern ability of the spry textfield validion.
    However, I am unable to fully understand how to implement the
    conditions I desire. I have read that you use:
    "B"; "b" for Case-insensitive alphabetic characters.
    I suppose my first question is, does that mean either B or b
    will work?
    What I am trying to accomplish for my first validation is:
    1- to allow between 1 and 15 characters to be entered. They
    should be only a) alphanumeric (number or letter) b) they MAY
    contain a space in there and c) the first character needs to be a
    letter. So, what I want it to scrub for is a char string no longer
    than 15 chars, number or letter (may contain a space, but that
    counts towards the 15) and the first char must be a letter.
    I have been playing around with the attributes:
    ("spryCustomtest", "custom", {validateOn:["blur"],
    minChars:1, maxChars:15, pattern:"a"});
    however, i am unable to see how to specify the pattern so
    that it allows for 1-15 chars and insists that only the first char
    is a letter......
    My second question is, how could I implement a field for
    heightened password-choosing rules....
    perhaps tell it to allow for:
    a) minimum of 8 characters
    b) at least one capital letter
    c) at least one special character or number
    d) maximum of 30 characters
    thanks for any help, Tex

    Did you ever find a solution for this?

  • Problem with acrobat 9 when validating text fields

    Hello
    I've been using a script to provide feedback for my English Students. The correct input turns the backgroundcolor to green, an incorrect one turns it to red. This script has been working fine for many years including Acrobat Reader 8, but version 9 gives me a problem. When filling in the field and pressing enter, nothing happens, only when you give focus to the filled in field again does the color change. Leaving the field turns the color again to its original. Here is a link to an example:
    http://schulen.eduhi.at/herderschule/pdf/E3/e3u1sentences.pdf
    Try it with reader 9 and a previous version and you'll see what I mean.
    Can somebody help me fix this problem?
    Here is the code that I'm using to validate the textfields:
    //TestLetter
    /*********** belongs to: Document-Level:TestLetter ***********/
         var f = this.getField("1")
              f.value = "";
         var f = this.getField("2")
              f.value = "";       
    function TestLetter(FieldName,FieldValue)
      var RetValue;
       RetValue = false;
      switch (FieldName)
        case "1":
          if (FieldValue == "in the Australian bush.")
               RetValue = true;
             break;
        case "2":
          if (FieldValue == "for a pack of dingoes.")
               RetValue = true;
                 break;
         default:
         RetValue = false;
         break;
      return  RetValue;
    //trim
    /*********** belongs to: Document-Level:trim ***********/
    function trim(inputString) {
       if (typeof inputString != "string") { return inputString; }
       var retValue = inputString;
       var ch = retValue.substring(0, 1);
       while (ch == " ") {
          retValue = retValue.substring(1, retValue.length);
          ch = retValue.substring(0, 1);
       ch = retValue.substring(retValue.length-1, retValue.length);
       while (ch == " ") {
          retValue = retValue.substring(0, retValue.length-1);
          ch = retValue.substring(retValue.length-1, retValue.length);
       while (retValue.indexOf("  ") != -1) {
          retValue = retValue.substring(0, retValue.indexOf("  "))
        + retValue.substring(retValue.indexOf("  ")+1, retValue.length);
       return retValue;
    //1:Validate
    /*********** belongs to: AcroForm:1:Validate ***********/
    event.value = trim(event.value);
    var f = this.getField("1"); /* field that the event occurs at */
         f.readonly = false;
         f.fillColor = color.ltGray
    if (event.value != "")
      if (TestLetter("1",event.value)==true)
        f.fillColor = color.green;
    else
      f.fillColor = color.red;
    //2:Validate
    /*********** belongs to: AcroForm:2:Validate ***********/
    event.value = trim(event.value);
    var f = this.getField("2"); /* field that the event occurs at */
         f.readonly = false;
         f.fillColor = color.ltGray
    if (event.value != "")
      if (TestLetter("2",event.value)==true)
        f.fillColor = color.green;
    Else
    f.fillColor = color.red;

    You probably have field highlighting turned on. You can use JavaScript in the file to turn off this user preference setting.
    I'd also suggest a code change:
    event.value = trim(event.value);
    var f = event.target; /* field that the event occurs at */
    George

  • 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

  • Spry Validation-text field shows the "required" text even in initial state

    Hi,
    I'm having trouble with spry validation.
    I insert my spry textfied and go to the properties inspector where  I choose validate on "Blur" and "submit" for the Required state. I check the required box for the "required state" but the initial state will also have the "a value is required" text. If I try to delete the "a value is required" text from the initial state, the required state won't show this error.
    What should I do?
    Any help is much appreciated.
    Thank you.

    Hi, thanks so much for the reply
    Well the javascript came with the spry file that I downloaded from the adobe site.
    Here is my statement:
      <label for="name"><span class="style87">Name:</span></label>
                      <span id="sprytextfield1">
                      <input name="name" type="text" class="textInput" id="name" />
                      <span class="textfieldRequiredMsg">A value is required.</span>                  </span></p>
                  <p> <span class="style87">
                      <label for="email">Email:</label>
                      </span><span id="sprytextfield2">
                      <input name="email" type="text" class="textInput" id="email" />
                      <span class="textfieldRequiredMsg">A value is required.</span></span></p>
    This is the statement for the submit button:
      <span class="clearIt">
                      <input name="send" type="submit" id="send" onclick="MM_validateForm('username','','R','password','','R','name','','R','email','','R' ,'comments','','R');return document.MM_returnValue" value="Send comments" />
                    </span><span class="clearIt">
                    <input type="hidden" name="MM_insert" value="form1" />
    This is the javascript
    <script type="text/javascript">
    <!--
    function MM_validateForm() { //v4.0
      if (document.getElementById){
        var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
        for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
          if (val) { nm=val.name; if ((val=val.value)!="") {
            if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
              if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
            } else if (test!='R') { num = parseFloat(val);
              if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
              if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
                min=test.substring(8,p); max=test.substring(p+1);
                if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
          } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
        } if (errors) alert('The following error(s) occurred:\n'+errors);
        document.MM_returnValue = (errors == '');
    //-->
    </script>
    This is at the bottom of the page:
    <script type="text/javascript">
    <!--
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["blur"]});
    //-->
    </script>
    Thank you for your help.

  • Spry Validation Text Field widget

    I want to make sure users insert a properly formatted email
    address, which I found out how to do here.
    http://livedocs.adobe.com/en_US/Spry/1.4/help.html?content=WSC7D22C22-1123-4e9b-8218-F317C DD39F2B.html
    The problem is that when the user inserts an invalid email
    address the text box stays red but no error message displays. How
    do I go about having the error message show. Right now it only
    shows if they leave the box blank.

    I went to
    http://labs.adobe.com/technologies/spry/demos/formsvalidation/
    to try to get an idea how they did their form and they have check
    marks and x to better define their section. It seems all the
    customizing requires knowledge of Javascript which I am not too
    strong in. I guess there is no menu driven method to duplicate that
    form.
    Looks like nobody else has played with form validation
    either.

Maybe you are looking for