A
fragment
is
a reusable part of a form. For example, a fragment can include an address
block or legal text.
A fragment
is managed in the Fragment Library and is stored as a separate XDP
file that can be inserted into multiple form designs. In the stand-alone
version of Designer, fragments are stored in the file system and in
the Fragment Library. In Designer with Workbench, fragments are
stored in the Fragment Library and in the AEM forms repository.
Using fragments simplifies and speeds up the creation and maintenance
of large numbers of forms. When creating a form, you insert a reference
to the required fragment and the fragment appears in the form. The
fragment reference contains a subform that points to the physical
XDP file.
All fragments share common characteristics:
-
You create all fragments the same way.
-
You can create a fragment in the current file or in a separate
file, and you can create multiple fragments in the same file.
When you
create a fragment in a separate file, a file is generated to store
the fragment in the file system or in the AEM forms repository.
-
Other form authors can use the fragments in their form designs.
-
You edit the fragment source files in Designer.
Fragments and subforms
To create a fragment, you can either select
an existing subform or select one or more objects. Subforms also
include tables, table rows, header rows, and footer rows. If you
select objects that are not in a subform, the objects are wrapped
in a subform when the fragment is created.
You can also use
a choice subform set that contains multiple fragment references. A
choice subform set
is
a variation of the subform set object that allows you to customize
the display of specific subforms from within the set by using conditional
statements. You use conditional statements to determine which subform from
within the set appears in the delivered form.
For example,
each subform in a set can include information for a particular state, and
the subform that is displayed can be determined based on the state
where the form is filed.
Script fragments
A
script fragment
contains reusable JavaScript
functions or values that are stored separately from a particular
object, such as a date parser or a web service invocation. These
fragments include a single script object that appears as a child of
variables in the Hierarchy palette. Fragments cannot be created
from scripts that are properties of other objects, such as event
scripts like validate, calculate, or initialize.
For more
information, see
Using
Script Fragments
.