See also: How to Program a Calculator in a PDF
You can retrieve the document in a document-level script by accessing the
event.target property, like this:
1 2 3
var document = event.target; var textField = document.getField("MyTextField"); // Do things with `textField`.
This code snippet will get a reference to the form field with the name
MyTextField in the document.
Various functions for formatting, validation, and calculation are also supported. You can read Adobe’s documentation to learn more about them.
As you can read in the API documentation,
cName argument must be a string.
In this other example, the script contains one API property that we currently don’t support: