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