6
Using Acrobat JavaScript in Forms
Forms Essentials
Defining Form Field Calculation Order
When you add a text field or combo box that has a calculation script to a document, the
new form field’s name is appended to the
calculation order array.
When a calculation event
occurs, the calculation script for each of the form fields in the array runs, beginning with the
first element in the array (array index
0)
and continuing in sequence to the end of the array.
If you would like one form field to have calculation precedence over another, you can
change its calculation index, accessed through the
field
object’s
calcOrderIndex
property. A form field script with a lower calculation index executes first. The following
code guarantees that the calculation script for form field
a
will run before the one for form
field
b
:
b.calcOrderIndex = a.calcOrderIndex + 1;
106
Acrobat JavaScript Scripting Guide