Adobe acrobat forms javascript object specification User Manual

Page of 64
Acrobat Forms - JavaScript Object Specification
56
Implementation Considerations
JavaScript Locations and Loading
JavaScripts work with Acrobat Forms on a variety of levels: the plug-in level, document level,
and field level. These levels restrict the type of processing that can occur and are loaded at
different times.
Plug-in folder level
JavaScripts can work as individual files with the “.js” extension. The Acrobat Forms plug-in
looks for these files on the UNIX platform in the Acrobat plug-ins folder. On the Apple
Macintosh and Windows platforms, the files are in a subfolder of the plug-ins/Acroform folder
called JavaScripts. Variables and functions that might be generally useful to the application
should be kept at the plug-in level.
There are some restrictions when writing plug-in level scripts particularly with respect to the
.
The standard Acrobat Forms implementation comes with two plug-in level files: Aform.js,
which contains built-in pre-canned functions and AFString.js, which contains the language
dependent strings needed by Aform.js.
The file glob.js is programmatically generated and contains cross-session application
preferences set using the global object’s
method.
If the file Config.js is present this file can be used to customize the look of the viewer
by removing toolbar buttons and menu items (see the application methods
and
The plug-in level scripts are loaded in the following order: Config.js (if it exists), AFString.js,
AForm.js, glob.js 
(if it exists), and then all other .js files in no particular order.
Document level
By using the Adobe Acrobat menu item Tools->Forms->Document Scripts…, the user can add,
modify, or delete document level scripts. These scripts should be function definitions that are
generally useful to the document but are not applicable outside the document. Document level
scripts are executed after the document has opened and after the plug-in level scripts are
loaded. Document level scripts are stored within the PDF document. Therefore, the forms
programmer should make every effort to package scripts as effectively as possible.
4.0