XFA Specification
Chapter 6, Template Features for Designing Forms with Repeating Sections
Forms with Repeated Fields or Subforms
214
ambiguities when data is round-tripped between client and server, hence merged with the
template, extracted and then merged again.
Another difference between global fields and non-global fields is that global fields are strictly
passive.
A
global field can never cause its ancestors to be copied into the Form DOM. Instead the field must be
dragged in when its enclosing subform is dragged in by a direct or indirect match to a data node. Only
then is an attempt made to match the global field to data in the current record, and if that fails to global
data.
There is also a difference between the handling of attributes in global data and non-global data. Attributes
of global data elements can not bind to fields. All such attributes are ignored by the data binding process.
As stated above, non-record mode is exactly equivalent to record mode with the mode options set such
that the whole data document is treated as a single record. Hence in non-record mode there is no such
thing as global data and marking a field as global has no effect.
Data Window
The placement of global data matters. If global data is placed after the record where it would be used, the
data binding process may not yet have loaded it. This specification does
not
dictate that XFA processors
perform two passes over the data document to pre-load globals. Rather, XFA processors support options
to control the loading of adjacent records into the Data DOM along with the current record. This is known
as a
data window
and it can include any specified number of records before and any specified number of
records after the current record. In most cases global data naturally comes near the beginning of the
document or just before the first record to use it. In other cases a larger data window is needed to ensure
that all needed global data is loaded before it is needed.
Explicit data references may be affected by the data window as well. A data reference can point to a data
node in a record other than the current record. If there is currently no match for the explicit data reference
in the Data DOM, the data binding process creates a node with default properties that matches the explicit
reference. This is the same behavior it displays when the appropriate section of the Data DOM is loaded
but there is no node matching the reference. Explicit data references should use
$record
to refer to data
in the current record,
$record[-1]
to refer to the previous record,
$record[+1]
to refer to the next
record and so on. For these references to work the data window must be set to include the desired
adjacent records.
Layout for Repeating Sections
In XFA the physical layout of displayable entities upon the page is controlled by
pageSet
,
pageArea
and
contentArea
elements. The
pageSet
and
pageArea
elements, like
subform
elements, have
occur
properties. Within a static form using repeating subforms it is normal to reuse these elements by supplying
occurrence values to them.
In the simplest case every page of the form is identical, except for the variable data within fields. In this
case the
occur
property of the
pageArea
element can simply be set to the required number of pages. As
with subforms the same value is supplied for the
min
and
initial
attributes, and the
max
attribute
defaults to the same value. For example in the following template fragment the subform has a
breakBefore
property which causes each instance of the subform to be laid out on a new page. The
breakBefore
property is discussed in
“Break Conditions” on page 216.