Fragments can contain reusable JavaScript functions or
values that are stored separately from any particular script object.
You use these fragments to create custom functions and properties
that you want to use in many locations on a form or that you want
to use in many forms.
For example, the countryScript sample fragment controls the interaction between
the Country and State/Province drop-down lists in the sample forms. The
options that appear in the State/Province drop-down list depend
on the country selected in the Country drop-down list.
To test a sample script fragmentOpen the My PO Interactive.pdf sample form and
click the Preview PDF tab in the Layout Editor.
Under the Ordered By section in the form, select Canada from
the Country drop-down list and then click the State/Province drop-down
list. The list displays provinces to select from.
Next, select United States from the Country drop-down list
and then click the State/Provinces drop-down list. The list displays
states to select from.
Next, we will take a closer look at the countryScript fragment
in the sample forms.
To view the script in the countryScript fragmentIn the Fragment Library palette, right-click countryScript
and select Edit Fragment.
Notice that the fragment is a child
of Variables in the Hierarchy palette. Fragments cannot contain
scripts that are associated with other form objects, such as event
scripts like validate, calculate, or initialize.
Select the countryScript script object in the Hierarchy palette.
Expand the Script Editor to view the script.
The
countryScript fragment is referenced by the drpDeliverToCountry
and drpDeliverToStatePrv Drop-down list objects in the OrderedByAddress
and DeliverToAddress fragments in the sample forms.
In the Fragment Library palette, right-click DeliverToAddress
and select Edit Fragment.
Select the drpDeliverToCountry Drop-down list object in the
Hierarchy palette and view the script in the Script Editor. Notice
how the countryScript fragment is referenced in the Script Editor.
Click to continue: Using fragments when controlling the display of subforms
|
|
|