Determining when to run your calculation or script

When creating calculations and scripts, you must associate each entry with a specific form event. Each form event represents a change in the form’s state that initiates at a specific time.

The change in form state can occur during form rendering on the server by Forms, or on the client by Acrobat or Adobe Reader while a user is filling a form.

When a change in the state of the form occurs, any calculations or scripts associated with the event are processed automatically.

The event you use when creating a calculation or script will, to some extent, determine what you must include in your calculation or script. For example, the amount and type of information available on a form may be different depending on the event timing you choose; therefore, a calculation or script that retrieves a value from a field may have different results if run before instead of after a form filler performs certain actions. For more information about events, see Events.

Depending on the type of form you are creating, some events may never occur. For example, if you are creating a form that has a fixed layout and no interactive objects, then interactive events associated with form filler actions may never occur and, as a result, any scripts associated with those events will not run.

Although Designer includes support for a wide variety of form events, it is possible to accomplish a wide variety of common calculation and scripting tasks by using only a few events that occur at major changes in a form’s state, such as the following events:

docReady
Initiates immediately after the form opens in Acrobat or Adobe Reader and immediately before the form filler can begin interacting with form objects. This event is the last event to occur before control of the form is given to the form filler.

enter
Initiates when the form filler changes the focus to a particular field, button, or subform.

exit
Initiates when the form filler changes the focus from a particular field, button, or subform, to another object.

change
Initiates when a form filler makes a change to a field value. This event is most commonly used with drop-down lists or list boxes to execute a script when a form filler makes a change to the current value.

click
Initiates when a form filler clicks a field or button. This event is most commonly used with buttons to execute a script when a form filler clicks the button.

// Ethnio survey code removed