Using Acrobat JavaScript in Forms
Forms Essentials
6
Making PDF Forms Web-Ready
PDF forms can be used in workflows that require the exchange of information over the
Web. You can create forms that run in Web browsers, and can submit and retrieve
information between the client and server by making a
Submit
button available in the
form. The button can perform similar tasks to those of HTML scripting macros.
You will need a CGI application on the Web server that can facilitate the exchange of your
form’s information with a database. The CGI application must be able to retrieve
information from forms in HTML, FDF, or XML formats.
In order to enable your PDF forms for data exchange over the Web, be sure to name your
form fields so that they match those in the CGI application. In addition, be sure to specify
the export values for radio buttons and check boxes.
The client side form data may be posted to the server using the HTML, FDF, XFDF, or PDF
formats. Note that the use of XFDF format results in the submission of XML-formatted data
to the server, which will need an XML parser or library to read the XFDF data. The
equivalent MIME types for all posted form data are shown below in
Table 6.5.
T
ABLE
6.5
MIME Types for Data Formats
Data Format
HTML
FDF
XFDF
PDF
XML
Creating Submit Buttons
MIME Type
application/x-www-form-urlencoded
application/vnd.fdf
application/vnd.adobe.xfdf
application/pdf
application/xml
When you use the Button tool, use the
MouseUp
trigger and select
Submit a Form.
You
may specify which data format is used when you select the
Export Format
option. If it is
necessary for the server to be able to recognize and reconstruct a digital signature, it is
advisable that you choose the
Incremental Changes to the PDF
option.
Creating Reset Form Buttons
In this case, when you create the
MouseUp
trigger, select
Reset a Form.
Now you will be
able to specify which form fields are reset.
Creating Import Data Buttons
First set up an FDF file with common data. In this case, when you create the
MouseUp
trigger, select
Import Form Data.
Acrobat JavaScript Scripting Guide
107