9
Automation Objects
This chapter describes the automation objects: calculate, validate, and event. It describes how automation
objects are typical used, how they are activated, and how they interact with other automation objects.
The processing application invokes automation objects in response to a trigger particular to the type of
object. Examples of such triggers include a form loading or a user clicking a field.
When an automation object is invoked, it performs some task particular to the type of object. Examples of
such tasks include executing a script or executing a web services file. The tasks that can be performed are
particular to the type of automation object.
How Script Elements Are Used Within Automation Objects
This section describes how procedural extensions such as calculations, validations, and event handling are
specified in a template. The procedural descriptions of how values within a form are validated and
calculated are among the central concepts that define what a form is. This is true of both electronic forms
and traditional paper-based forms.
Electronic forms may be processed by a wide variety of processing applications. The obvious example is a
visual presentation of a form that allows the user to enter data. In such a context, the form can be
associated with a set of behaviors that can be described procedurally. This kind of scripting of
user-initiated events is common to many applications. This specification recognizes that a form may be
part of a much larger process. At each stage in that process, the form may be processed by very different
kinds of applications. This specification allows a single form template to describe behaviors appropriate to
very different processing applications within that process.
The XFA family of specifications includes a scripting language called FormCalc [“FormCalc
on page 801],
a simple expression language that implements a common set of functions useful for
calculation. While FormCalc has special status due to the need for interoperable form templates, this
specification allows processing applications to support alternative scripting languages such as
ECMAScript[ECMAScript].
This specification takes the position that the abstraction of the form object model that is presented to any
particular scripting language is not an inherent property of either the form object model or the scripting
engine, but is a distinct script binding (not to be confused with data binding). The XFA Scripting Object
Model specification [“Scripting
describes a script binding between the form
object model and the scripting languages (in particular, FormCalc) that can be used for interoperable form
templates.
The related set of values associated with form elements is an essential aspect of what a form represents.
This specification defines the following methods for defining the value of a field:
●
Set an initial value, by providing non-empty content in a
value
element. A static value would be
defined by the template designer.
Bind data to a value. Such data is provided by an external source, such as a person filling in the form or
by a database server.
Derive a value dynamically, likely from other form values or ambient properties such as date and time.
Such a value is defined using the
calculate
element.
●
●
291