8
Dynamic Forms
This chapter explains how XFA processing applications support binding and layout in dynamic forms. A
dynamic forms differ from static forms in their ability to dynamically add containers and rearrange layout
depending on the data being entered.
“Basic Data Binding to Produce the XFA Form DOM” on page 154
and
“Basic Layout” on page 50
describes layout for static forms.
Static Forms Versus Dynamic Forms
In a static form the template is laid out exactly as the form will be presented. When the template is merged
with data, some fields are filled in. Any fields left unfilled are present in the form but empty (or optionally
given default data). These types of forms are uncomplicated and easy to design, though not as capable as
dynamic forms. XFA supports both static and dynamic forms.
In a dynamic form the number of occurrences of form components is determined by the data. For
example, if the data contains enough entries to fill a particular subform 7 times, then the Form DOM
incorporates 7 copies of the subform. Depending on the template, subforms may be omitted entirely or
rearranged, or one subform out of a set selected by the data. Dynamic forms are more difficult to design
than static forms but they do not have to be redesigned as often when the data changes. In addition
dynamic forms can provide an enhanced visual presentation to the user because unused portions of the
form are omitted rather than simply left blank. When printed, dynamic forms save paper and toner. When
displayed on glass, dynamic forms eliminate unnecessary scrolling.
Whether a form is static or dynamic is determined when it is designed. In addition a form may be partly
dynamic and partly static. The mechanism is controllable at the level of individual subforms. When a
subform has no
occur
sub-element, or its minimum, maximum, and initial occurrence properties are all
set to 1, it is static. When the values are fixed and equal but not 1 (for example if they are all 7), the subform
is also static. In such a subform the occurrence values merely take the place of replicating the subform so
many times. But if the values are unequal or if the maximum occurrence is unlimited (indicated by a value
of -1), the subform is dynamic. For example, if the maximum occurrence is unlimited the data binding
process will keep adding more copies of the subform to the Form DOM until it has used up all the
matching data from the Data DOM.
In addition, a form is dynamic if it includes subform sets. Subform sets allow for subforms to be grouped
into sets with certain logical relationships. For example, one out of a set of subforms can be incorporated
depending upon what element is present in the data. Any given subform set can express an ordered set,
an unordered set, or a choice set, corresponding to the set relationships defined in [
XML Schema
The same data that is used with a static form can also be used with a dynamic form.
259