XFA Specification
Chapter 3, Object Models in XFA
Scripting Object Model
81
For static forms, similar to a traditional pre-printed paper form, the structure is entirely supplied by the
Template DOM. In this case the Form DOM is a duplicate of the subtree under the root subform in the
Template DOM, except that some objects in the Form DOM are bound to nodes in the Data DOM.
For dynamic forms the form structure varies in response to the data. For example a subform and its fields
can be copied into the Form DOM once for each record of data. In this case the objects in the Form DOM
are still copied from the Template DOM but the number of copies and/or the arrangement of objects is
dictated by the data.
The degree and nature of dynamisms is controlled at the level of individual objects in the Template DOM.
Hence a form can be partly static and partly dynamic. For example, a subform may be included in the Form
DOM conditionally upon the presence of a particular data item, yet the conditional subform may itself
have a fixed appearance and content.
Data binding is controlled by properties of the objects in the Template DOM and by the names and
hierarchy of the objects in both the Template DOM and the XFA Data DOM. The process of binding data to
logical structure is described in
“Basic Data Binding to Produce the XFA Form DOM” on page 154.
Template DOM, Form DOM, and Layout DOM
The Layout DOM is the place where objects from the Form DOM, or parts of objects, are placed upon one
or more pages. The result is objects copied from the Template DOM and the Form DOM to the Layout
DOM, with each object in the Layout DOM assigned a place upon a particular page.
The Template DOM supplies objects representing sets of pages, pages, and regions of pages. These are
copied into the highest levels of the Layout DOM hierarchy. Objects from the Form DOM are copied into
the lower levels, in the place they occupy when displayed or printed. An object from the Form DOM can
split across multiple locations (for example, text can flow from one column to the next). Hence a single
object in the Form DOM may be copied multiple times into the Layout DOM, with each copy in the Layout
DOM representing a different fraction of its content.
Objects representing sets of pages, pages, and regions of pages may be allowed to repeat and/or vary in
number. In this way the physical representation of the form can vary with the data.
The layout process can automatically insert headers and footers, leaders and trailers. When these are
inserted they are copied from subform objects in the Template DOM.
In interactive applications the GUI is downstream from the Layout DOM. However the GUI also emits data
(keyed in) and events (such as mouse clicks). This data and these events are passed upstream by the
Layout DOM to the Form DOM. When data is entered it is forwarded to the appropriate field or exclusion
group in the Form DOM and updates the data there. When an GUI event causes a script to be activated the
script’s
$
or
this
object is set to the corresponding object in the Form DOM. Thus the Layout DOM is
transparent to scripts and user actions.
Layout operations are controlled by properties of the objects being laid out, properties which are copied
from the Form DOM but in turn originate from the Template DOM. The process of laying out the form upon
one or more pages is described in
“Layout for Dynamic Forms” on page 280.
Scripting Object Model
This section explains the conventions for referencing the properties and methods in the object models
used by an XFA processing application.