Process All Fields

A common requirement on the “Adobe Designer Forums”: is to find all fields on a form and do something specific with them.

For instance, you may want all mandatory fields to be automatically highlighted when a user attempts to submit a form electronically before having filled all mandatory fields. While Acrobat provides a button to toggle mandatory field highlighting on/off (via the _Highlight required fields_ check box in the yellow Form Field toolbar), Acrobat’s Scripting Object Model doesn’t provide a function to do the same. Therefore, you’re left having to write some script to achieve the same functionality.

Since this is requested so often, I thought I would try to put together some canned script that you can copy and paste into your form in order to instantly have the ability to make changes on everything that’s considered a field on your form.

“Download Script [js]“:
“Download Sample [zip]“:

*Minimum Requirements:* Designer 7.0, Acrobat 7.0.

The first download is for a JavaScript file which contains the “plug & play” script that you can simply copy & paste into any event handler or script object and immediately start concentrating on what you want to do when you find a button, a check box, a text edit, etc.It’s divided into two parts: The first (at the top-end of the script) is a series of _Field Processor Functions_ for each field/object type that may be found within a form. Each function receives a reference to the field in question. The second (at the bottom-end of the script) defines the _ProcessAllFields_ function — the brains behind this operation. This function detects the field type and calls the appropriate _Field Processor Function_.All you need to do is add script to the _Field Processor Function(s)_ for the field types you need to do stuff with.The second download contains the JavaScript file along with a sample form which demonstrates how to get from the bare-bones _Field Processor Functions_ and _ProcessAllFields_ function to a solution which finds all non-filled mandatory fields on a form and highlights them with the current Acrobat Highlight Color. You’ll find customized versions of the _Field Processor Functions_ and _ProcessAllFields_ function in the script object (named “ScriptObject” — yes, I know, this is an unbelievably original name!) while the script execution flow begins in the Submit button’s Click event.When the Submit button is clicked, the form is search for non-filled (empty) mandatory fields. If such fields are found, they’ll be highlighted, the RemoveHighlight button will be made visible and an error message will be displayed. Otherwise, the Email Submit dialog will open.