I'm creating an Acrobat form (not LiveCycle) using Acrobat X on Windows. The form needs to be accessible, and I need to alert users when a required field is not filed out.
I tried using this code in the Action, On Blur for the required field:
app.alert ("This field is required. Please enter a value.")
While the code does bring up an alert message, I can't close the alert dialog, nor can I add I fill out the required field because I can't get past closing the dialog.
Does anyone have a suggestion?
Place f.setFocus() after the alert.
By the way, this line:
can be replaced by this:
f = event.target;
should be replaced with:
if (f.valueAsString.length == 0)
or better yet:
Since for certain field entries (e.g., numbers, "true", "false"), the length property of the value will be undefined, since the value property won't be a string or array. The code works since "".length == 0 evaluates to true and undefined == 0 evaluates to false, but it's a bit sloppy.
Working great now. THANK YOU! THANK YOU!