XFA Specification
Chapter 9, Automation Objects
Validations
300
Types of Validation Tests
Validation provides up to four types of tests. The following table describes those test types, the order in
which they are executed, and their relevance to the container element. All but the data-type test are
specified in the container element’s
validate
element.
Exe-
cution
order
1
Test type
Null-content test (
nullTest
). Null content is not
allowed. Typically, this is a mechanism for
ensuring the user enters a value in a particular
container object. This test is not applicable if the
template provides a default value.
Datatype test. The datatype of a field must be
consistent with the type of data entered in the
field. Unlike the other validation tests, this test is
not specified in the
validate
element; rather,
the datatype test is implied by the existence of a
datatype element (i.e.
integer
and
float
)
within the field’s
value
element, and the error
messages it generates are application-specific.
Format test (
formatTest
). The format of the
value must match the picture clause specified in
the
validate
element.
Script test (
scriptTest
). The script supplied in
the
validate
element must return a true value
for a script test to succeed.
Field
Container element
Subform
Not
applicable
Exclusion
group
2
Not
applicable
Not
applicable
3
Not
applicable
Not
applicable
4
For any field, subform, or exclusion group. All validation tests specified for a field, subform, or exclusion
group must succeed for the form object's value to be considered valid. If any test fails, the XFA processing
application responds, as described in
“Responding to Test Failures” on page 302.
As described in the
“Localization and Canonicalization” on page 140,
the result of any presentation
formatting defined for the form object does not alter the value of the form object — it remains
unformatted. Therefore, validation tests (nullTest, formatTest, and scriptTest) are performed against the
unformatted value.
Activation
Validate elements can be activated multiple times during the life of a form.
Initialization
When an XFA-processing application initializes a form, it executes all validation tests specified for the form.
Home Index Bookmark Pages
Pages: Home Index All Pages