Valid property

TextDropDownField.Valid — Logical

Represents whether the field is valid. The value of an invalid field is shown in red (unless a different warning color has been set). Below the field, a validation message is shown. Customize it through the ValidationMessage property.

To make a field required, use this property in conjunction with the NextScreenAvailable property of screens (preventing users from moving on to the next screen) and the Enabled property of buttons (preventing users from pressing a button). See below for more information.

Writing formulas determining if a field is valid

To determine if a field is valid, you must write a formula and associate it with this property. This formula must return TRUE if the field is valid and FALSE otherwise.

This formula only considers values consisting of three characters or more to be valid:

LEN(TextDropDownField1) >= 3LEN(TextDropDownField1) >= 3

We suggest that you consider blank field values to be valid. The alternative is for your users to be greeted by forms with validation messages already shown, which does not look inviting.

To consider blank values valid, use the ISBLANK function. Here's the formula above rewritten to accept blank values:

ISBLANK(TextDropDownField1) || LEN(TextDropDownField1) >= 3ISBLANK(TextDropDownField1) || LEN(TextDropDownField1) >= 3

(|| should be read as "or.")

Determining if a field is valid from a formula

On its own, the Valid property only shows a validation message and displays the field value in a different color if the field fails validation. Users are not prevented from moving on to a different screen or from pressing buttons, nor are any calculations inhibited.

Enable these features by accessing whether a field is valid from other formulas. For example, associate the following formula with the Value property of Field2 to prevent it from calculating a value unless Field1 is valid:

IF(Field1.Valid, Field1 * 100)IF(Field1,Valid; Field1 * 100)

If blank values are considered valid (which we recommend), you also need to use ISDEFINED to make sure that a value has been entered:

IF(ISDEFINED(Field1) && Field1.Valid, Field1 * 100)IF(ISDEFINED(Field1) && Field1,Valid; Field1 * 100)

(&& should be read as "and.")

To prevent a user from moving to the next screen, unless both Field1 and Field2 are valid and have defined values, associate a formula like the following with the NextScreenAvailable property of a form screen:

ISDEFINED(Field1) && Field1.Valid && ISDEFINED(Field2) && Field2.ValidISDEFINED(Field1) && Field1,Valid && ISDEFINED(Field2) && Field2,Valid

To prevent a user from pressing a button unless all fields of the Field1:Field5Field1:Field5 range are valid and have defined values, associate a formula like the following with the Enabled property of a button:

AND(ISDEFINED(Field1:Field5) && (Field1:Field5).Valid)AND(ISDEFINED(Field1:Field5) && (Field1:Field5),Valid)

The Field1:Field5Field1:Field5 range includes Field1 and Field5, as well as all fields appearing between them. (Field1:Field5).Valid(Field1:Field5),Valid returns a logical array like { TRUE, FALSE, TRUE, TRUE, FALSE }{ TRUE; FALSE; TRUE; TRUE; FALSE }, where each individual element indicates whether the corresponding field is valid.

ISDEFINED(Field1:Field5)ISDEFINED(Field1:Field5) also returns a logical array, where each individual element indicates whether the corresponding field value is defined (not blank). When && is applied to two arrays, a single logical array is returned, where each individual element is only TRUE if the elements at the same position in the two arrays are both TRUE. The net effect is that an array is returned, where each individual element indicates whether the corresponding field is both valid and has a defined value.

Finally, AND is applied to the resulting array and only returns TRUE if all elements of it are TRUE. The end result is that the formula only returns TRUE if all fields of the Field1:Field5Field1:Field5 range have defined values and are valid.

Examples

LEN(TextDropDownField1) >= 3LEN(TextDropDownField1) >= 3

Considers a text drop-down field to be valid only if the number of characters appearing in its value is greater than or equal to 3.

ISBLANK(TextDropDownField1) || LEN(TextDropDownField1) >= 3ISBLANK(TextDropDownField1) || LEN(TextDropDownField1) >= 3

Considers a text drop-down field to be valid only if the number of characters appearing in its value is greater than or equal to 3, or if it is blank. We recommend that blank values are considered valid, so as to not have forms warn users of erroneous values before any values have been entered.

IF(ISDEFINED(Field1) && Field1.Valid, Field1 * 100)IF(ISDEFINED(Field1) && Field1,Valid; Field1 * 100)

This formula is associated with the Value property of a number field. A value is only calculated if Field1 has a defined value and is valid. Otherwise, a blank value is produced.

ISDEFINED(Field1) && Field1.Valid && ISDEFINED(Field2) && Field2.ValidISDEFINED(Field1) && Field1,Valid && ISDEFINED(Field2) && Field2,Valid

This formula is associated with the NextScreenAvailable property of a screen. The user is only permitted to proceed to the next screen if Field1 and Field2 both have defined values and are considered valid.

AND(ISDEFINED(Field1:Field5) && (Field1:Field5).Valid)AND(ISDEFINED(Field1:Field5) && (Field1:Field5),Valid)

This formula is associated with the Enabled property of a button. The user is only permitted to press the button if all fields of the Field1:Field5Field1:Field5 range have defined values and are considered valid. The Field1:Field5Field1:Field5 range includes Field1, Field5 and all fields that appear between them.