Chapter 1, Introduction to XML Forms Architecture (XFA)
XFA Specification
Major Components of an XFA Form: XFA Template and Data
20
The field element, a container for variable data
Variable data
can change during the life of the form and is provided by any of the following: the template
as a default value, the person filling out the form, an external source such as a data base server, a
calculation, and other sources. The template can specify default data for fields. The other sources of data
come into play when an XFA processing application represents the template and associated grammars as
an interactive form.
Variable data is described in field elements.
“A simple XFA form”includes
callouts that indicate a few of the
many
field
elements on this form. Note, the submit-button in the lower-left corner is also a field.
Containers of Other Containers
Template containers provide the structure for the form, by collecting other containers into repeatable sets.
Containers of other containers include the following:
exclusion group: Container of multiple fields. Exclusion groups represent a radio-button grouping.
subform: Container of other containers. The subforms that appear in a form may be pre-determined (as
in a static form) or may expand to accommodate the data bound to it (as in a dynamic form).
page area or area: An abstract representation of the physical page or other area in which other
containers are placed. The area does not change in size, but if its capacity is exceeded, a new area is
created.
Laying Out the Containers (and Their Data) to Create the Form’s Appearance
Each subform and area is a little form (in the conventional sense) in and of itself. Subforms are assembled
together, often in response to structure in the bound data, in order to create the final document. Subforms
also support repeating, optional and conditional data groups. When the XFA processing application
creates an interactive form, it considers the template and the data, adding enough copies of the subform
to accommodate the data present.
Allowing the data to drive the number of subforms used in a form has several advantages. It is less
error-prone than predefining multiple instances of the subform, and the template designer need not
guess at a maximum possible number to handle all anticipated cases. In addition, because XFA Template is
a declarative language, there is no need to write script to create such instances when the content is bound.
An important feature of XFA Template is that a template can stand alone. It doesn't need data to bring it to
life. A template without data is the equivalent of a blank form, ready for filling.
Scripted Components of an XFA Template
It is important to understand that scripting is optional. The template designer can take advantage of
scripting to provide a richer user experience, but all of the features described so far operate without the
use of scripts. Script creation is part of the template designing process.
XFA supports scripting in ECMAScript [ECMAScript], but it also defines its own script language, FormCalc
[“FormCalc
Specification” on page 801].
Often, the scripts attached to a form are similar to those attached
to a spread-sheet. FormCalc has been designed as an expression-oriented language, with simple syntax for
dealing with groups of values in aggregate operations.
Both ECMAScript and FormCalc expose the same object model. Scripting almost always works with data
values, so these are easily referenced. Indeed, XFA defines a complete Scripting Object Model (“Scripting
Object Model” on page 81).
A key feature of XFA-SOM is that it manages relative references. For example,
Home Index Bookmark Pages
Pages: Home Index All Pages