Adobe acrobat forms javascript object specification 用户手册

下载
页码 64
Acrobat Forms - JavaScript Object Specification
32
The user interface for Acrobat Forms allows the author to specify a Selection Change script for
list boxes. The script is triggered every time an item is selected. This is implemented as the
keystroke event where the keystroke value is equivalent to the user selection
.
This behavior is
also implemented for the combo box
the “keystroke” could be thought to be a paste into the
text field of the value selected from the drop down list.
There is a final call to the keystroke script before the validate event is triggered. This call sets
the willCommit property to true for the event. With keystroke processing, it is sometimes
useful to make a final check on the field value before it is committed (pre-commit). This
allows the script writer to gracefully handle particularly complex formats that can only be
partially checked on a keystroke by keystroke basis.
Validate
Regardless of the field type, user interaction with the field may produce a new value for that
field. After the user has either clicked outside a field, tabbed to another field, or pressed the
enter key, the user is said to have committed the new data value.
The validate event is the first event generated for a field after the value has been committed so
that a JavaScript can verify that the value entered was correct. If the validate event is
successful, the next event triggered is the calculate event.
Calculate
The calculate event causes all fields that have a calculation script attached to them to be
executed. All fields that depend on the value of the validated field will now be re-calculated.
These fields may in turn generate additional validate, calculate, and format events.
Calculated fields may have dependencies on other calculated fields whose values must be
determined beforehand. The calculation order array contains an ordered list of all the fields in
a document that have a calculation script attached. When a full calculation is needed, each of
the fields in the array is calculated in turn starting with the zeroth index of the array and
continuing in sequence to the end of the array.
To change the calculation order of fields, use the Tools->Forms->JavaScript->Set Calculation
Order... 
menu item in Adobe Acrobat.
Format
Once all dependent calculations have been performed the format event is triggered. This event
allows the attached JavaScript to change the way that the data value appears to a user (also
known as its presentation or appearance). For example, if a data value is a number and the
context in which it should be displayed is currency, the formatting script can add a dollar sign
($) to the front of the value and limit it to two decimal places past the decimal point.