
Using Help
|
Contents
|
Index
Back
166
Adobe Acrobat Help
PDF Forms
Using Help
|
Contents
|
Index
Back
166
The script created in step 10 defines a variable f, which corresponds to the value of the
ValueA
field, and another variable g, which corresponds to the value of the
ValueB
field. The
script then defines an event that calculates the difference between the values of the two
variables. This calculation is automatically displayed in the
ResultsC
field.
To divide the value for variable f by variable g, replace the script text in step 10 with the
following text:
var f = this.getField(“ValueA”);
var g = this.getField(“ValueB”);
event.value = f.value / g.value;
To multiply the value for variable f by variable g, type in the following script (in its exact
format):
var f = this.getField(“ValueA”);
var g = this.getField(“ValueB”);
event.value = f.value * g.value;
12
Click OK in the Field Properties window.
Assigning a ‘go to page’ action
If you create a multiple page form, it is useful to add a button that automatically takes you
to the next page. This type of action is most commonly associated with the Mouse Up
action.
The JavaScript you use to take you to the next page at the click of a button can be easily
modified to automatically take you to the previous page of the form, the first page of the
form, or the last page of the form. All these variations are presented in the following
procedure.
To specify a ‘go to page’ action for a button:
1
Select the form tool
, and create a form field. For information, see
“Creating form
fields” on page 145
. Name this field
GoNext
.
If you want to create several ‘go to page’ buttons on the same form, name each field
accordingly:
GoNext
,
GoPrev
,
GoFirst
, and
GoLast
.
2
Choose Button from the Type menu, and specify the border, background, text, and field
appearances. Click the Options tab, and specify selections as needed. For more infor-
mation, see
“Creating interactive buttons” on page 173
.
3
Click the Actions tab, choose Mouse Up, and then click Add.
4
Choose JavaScript from the Type menu, and then click Edit.
5
To specify
go to the next page
when the button is selected, in the script window, type in
the following text in the exact format, and click OK:
this.+;
For other go to page buttons, use the following scripts with the appropriate button fields:
Go to the previous page:
this.pageNum--;
Go to the first page:
this.pageNum = 0;
Go to the last page: