These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Validation script not working?

mazz930
Registered: Jun 2 2010
Posts: 2

so i have a form, in which the fields need to be validated that they have something in them (a-z 0-9, etc). i put this script in the validate>run custom validation script box, and it doesnt seem to be working. it lets me tab to the next field. I know nothing about javascript, but i got this script from adobe forums. If i put it into the "on blur" action, it wont let me go back and edit the field to put something in the field. So i know the script works, but it wont work if its in the validation script box. Help!!!thanks

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')

}

My Product Information:
Acrobat Pro 9.3.1, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
And why are you not using the validation tab?

Also your script and location will not allow the form to be cleared!

If you set the field value to a null string you also make it very hard for a user to exit the field without completion of the field. Adobe leaves the erroneous data so the user can see what was entered and fix it. It is also a good practice to verify that all required fields are completed before allowing the final processing of the form. It may happen that users can not finish a form in one sitting and you need to allow a friendly way for them to save the incomplete form.

[url=http://forums.adobe.com/thread/651042?tstart=0]Requiring form fields, error with script[/url]

George Kaiser