1 Reply Latest reply on Jun 2, 2010 7:33 AM by gkaiseril

    Requiring form fields, error with script

    mazz930

      So, am trying to require fields in a form. all that is required is to enter a value. I tried using this script in the "on blur" action, and it does work, except it keeps popping up the message and wont let me enter a value. Whats wrong here?

       

      f = getField(event.target.name)
      if (f.value.length == 0)
         {   
         f.setFocus()   
         //Optional Message - Comment out the next line to remove
         app.alert("This field is required. Please enter a value.")
         }

        • 1. Re: Requiring form fields, error with script
          gkaiseril MVP & Adobe Community Professional

          If you are trying to access the value of the field as a string. Also you might try using the 'Validation' tab. Using the on burr action will keep a user locked into that field. The Validation will throw the error but allow the user to move to another field. You should also have a final check of the form to make sure all of the required fields are filled in.

           

          if (event.value.toString().length == 0) {   
             event.rc = false;
             this.getField(event.target.name).setFocus()   
             //Optional Message - Comment out the next line to remove
             app.alert("This field is required. Please enter a value.",  1, 0, 'Required Field')

             }