Using Acrobat JavaScript in Forms
Forms Essentials
6
Creating Acrobat Form Fields
There are seven types of Acrobat form fields, each associated with a field type value as
shown below in
Table 6.1:
T
ABLE
6.1
Acrobat Form Field Types
Form Field
Button
Check Box
Combo Box
List Box
Radio Button
Text Field
Digital Signature
Field Type Value
button
checkbox
combobox
listbox
radiobutton
text
signature
You can use Acrobat JavaScript to create a form field by invoking the
doc
object’s
addField()
method, which returns a
field
object. This method permits you to specify
the following information:
1.
The field name. This may include hierarchical syntax in order to facilitate logical
groupings. For example, the name
myGroup.firstField
implies that the form field
firstField
belongs to a group of fields called
myGroup
. The advantage of creating
logical hierarchies is that you can enforce consistency among the properties of related
form fields by setting the properties of the group, which automatically propagate to all
form fields within the group.
2.
One of the seven field type values listed above, surrounded by quotes.
3.
The page number where the form field is placed, which corresponds to a zero-based
indexing scheme. Thus, the first page is considered to be page 0.
4.
The location, specified in rotated user space (the origin is located at the bottom left
corner of the page), on the page where the form field is placed. The location is specified
through the use of an array of 4 values. The first two values represent the coordinates of
the upper left corner, and the second two values represent the coordinates of the lower
right corner:
[
upper-left x, upper-left y, lower-right x, lower-right y
]
.
Acrobat JavaScript Scripting Guide
89