nullTest

Controls whether a field is mandatory on a form or if it can be left empty.

The nullTest property can be used for validations. A nullTest validation is evaluated only as a result of pre-event validation , such as preSubmit, prePrint, preSave, or preExecute, depending on the value of $config.present.validate, or an explicit scripting call to execValidate.

A container becomes invalid as the result of evaluating the first validation test that fails. A container becomes valid if no validation tests fail. A container is valid when no validation tests are evaluated for that container. In that validation context, nullTest is not evaluated and there is no other validation test.

For example, a field that is currently invalid because of a nullTest validation could become valid as a result of a value being entered. Returning to the field and entering an empty value does not cause the nullTest validation to be executed automatically, so the field could become valid again. A subsequent attempt to submit the form would cause the field to become invalid again because of the nullTest.

If the rawValue for a field is null or empty, the nullTest validation failed .

Syntax

Reference_Syntax.nullTest = "disabled | error | warning"

Values

Type

Values

String

  • disabled (default)

  • error

  • warning

  • dismiss: The user understands the form’s recommendation and wishes to return to the form and satisfy this constraint.

  • override: The user understands the form’s recommendation, but has chosen to contravene this constraint.

Do not perform this test (default). The form object is permitted to have a value of null. The field can be left without a value and it will not negatively impact the validity of the form. This value disables the validation test.

  • error

  • warning

  • dismiss: The user understands the form’s recommendation and wishes to return to the form and satisfy this constraint.

  • override: The user understands the form’s recommendation, but has chosen to contravene this constraint.

Emit an error message and refuse to accept an empty field. The form object is required to have a non-null value.

  • warning

  • dismiss: The user understands the form’s recommendation and wishes to return to the form and satisfy this constraint.

  • override: The user understands the form’s recommendation, but has chosen to contravene this constraint.

Emit a warning message if the field is empty, but allow the user to proceed to the next field. The message must inform the user that the form object is recommended to have a value, and provide two choices:

  • dismiss: The user understands the form’s recommendation and wishes to return to the form and satisfy this constraint.

  • override: The user understands the form’s recommendation, but has chosen to contravene this constraint.

Applies to

Model

Object

Form Model

validate

Version

XFA 2.1

Examples

JavaScript

TextField1.validate.nullTest = "error";

FormCalc

TextField1.validate.nullTest = "error"

// Ethnio survey code removed