Validation Rules for "Validation Rules" Settings
Use these rules to describe how to validate your Screen controls.
Overview
Use validation rules in a control to constitute what is a valid value entered for that control.
If a control that has a Validation Rules setting but does not contain any value or properly structured validation rule, that control automatically passes validation.
If a control is hidden using Visibility Rules, any Validation Rules associated with that control are not evaluated upon submission of the Screen.
Controls That Provide Validation
The following Screen Builder controls use the validation rules:
Line Input control
Textarea control
Select List control
Checkbox control
Date Picker control
Create a Validation Rule
Follow these steps to add a validation rule to a Screen Builder control that provides validation:
Access the Variable panel for the control while in Design mode, and then locate the Validation Rules setting.
Click the Add Rule button. The Select drop-down menu displays.
Select the rule that this control validates against.
Click Save. Parameters for the selected rule display. Parameter settings display which ones are required to properly configure the rule.
Enter the parameter settings that this control uses to validate against. See Validation Rule Settings, and then locate the validation rule for its parameters.
Ensure Validation Fails for an Undefined Setting
If you want a validation to fail for undefined or ''
, use the required rule.
Validation Rule Settings
Accepted
Use the Accepted
validation rule to validate acknowledgement of this control. This is useful to validate "Terms of Service" acceptance.
Follow these steps to configure the parameter(s) for an Accepted
validation rule:
From the Select drop-down menu in the Validation Rules setting, select Accepted. The
Accepted
validation rule has no parameters.
After Date
Use the After Date
validation rule to validate that the value entered into this control must be after (later than) a specified date. If the entered value is in datetime format, then the time format is ignored.
The value entered into this control must be in one of the following formats:
Date format:
YYYY-MM-DD
. Example:"2020-07-01"
Datetime format:
YYYY-MM-DD HH:MM:SS
. Example:"2020-07-01 14:25:15"
Follow these steps to configure the parameter(s) for an After Date
validation rule:
From the Select drop-down menu in the Validation Rules setting, select After Date. The Date setting displays.
In the Date setting, enter the date in date format that this control's value must be after (later than). This is a required setting.
After Or Equal To Date
Use the After or Equal to Date
validation rule to validate that the value entered into this control must be the same or after (later than) a specified date. If the entered value is in datetime format, then the time format is ignored.
The value entered into this control must be in one of the following formats:
Date format:
YYYY-MM-DD
. Example:"2020-07-01"
Datetime format:
YYYY-MM-DD HH:MM:SS
. Example:"2020-07-01 14:25:15"
Follow these steps to configure the parameter(s) for an After or Equal to Date
validation rule:
From the Select drop-down menu in the Validation Rules setting, select After or Equal to Date. The Date setting displays.
In the Date setting, enter the date in date format that this control's value must be the same or after (later than). This is a required setting.
Alpha
Use the Alpha
validation rule to validate that the value entered into this control must be contain only alphabetic characters.
Follow these steps to configure the parameter(s) for an Alpha
validation rule:
From the Select drop-down menu in the Validation Rules setting, select Alpha. The
Alpha
validation rule has no parameters.
Alpha-Numeric
Use the Alpha-Numeric
validation rule to validate that the value entered into this control must contain only alphanumeric characters.
Follow these steps to configure the parameter(s) for an Alpha-Numeric
validation rule:
From the Select drop-down menu in the Validation Rules setting, select Alpha-Numeric. The
Alpha-Numeric
validation rule has no parameters.
Before Date
Use the Before Date
validation rule to validate that the value entered into this control must be before (earlier than) a specified date. If the entered value is in datetime format, then the time format is ignored.
The value entered into this control must be in one of the following formats:
Date format:
YYYY-MM-DD
. Example:"2020-07-01"
Datetime format:
YYYY-MM-DD HH:MM:SS
. Example:"2020-07-01 14:25:15"
Follow these steps to configure the parameter(s) for a Before Date
validation rule:
From the Select drop-down menu in the Validation Rules setting, select Before Date. The Date setting displays.
In the Date setting, enter the date in date format that this control's value must be before (earlier than). This is a required setting.
Before Or Equal To Date
Use the Before or Equal to Date
validation rule to validate that the value entered into this control must be the same or before (earlier than) a specified date. If the entered value is in datetime format, then the time format is ignored.
The value entered into this control must be in one of the following formats:
Date format:
YYYY-MM-DD
. Example:"2020-07-01"
Datetime format:
YYYY-MM-DD HH:MM:SS
. Example:"2020-07-01 14:25:15"
Follow these steps to configure the parameter(s) for a Before or Equal to Date
validation rule:
From the Select drop-down menu in the Validation Rules setting, select Before or Equal to Date. The Date setting displays.
In the Date setting, enter the date in date format that this control's value must be the same or before (earlier than). This is a required setting.
Between Min & Max
Use the Between Min & Max
validation rule to validate that the numerical value that this control contains is between the specified minimum value and a maximum value.
The Between Min & Max
validation rule evaluates the following:
integers
file sizes
The Between Min & Max
validation rule does not evaluate the number of characters in a text, but only the value of an entered number. Use one or both of the following to validate the number of characters in a text:
Furthermore, the Between Min & Max
validation rule does not evaluate calendar dates, such as when an entered value in that control is between two dates. Use any of the following to validate date-related values:
Follow these steps to configure the parameter(s) for a Between Min & Max
validation rule:
From the Select drop-down menu in the Validation Rules setting, select Between Min & Max. The Min and Max parameter settings display.
In the Min parameter setting, enter the numeric value that this control's value must be equal to or no lower than. This is a required setting.
In the Max parameter setting, enter the numeric value that this control's value must be equal to or no greater than. This is a required setting.
Date
Use the Date
validation rule to validate that the value entered into this control is in date or datetime format.
One of the following formats validates that the entered value is a date:
Date format:
YYYY-MM-DD
. Example:"2020-07-01"
Datetime format:
YYYY-MM-DD HH:MM:SS
. Example:"2020-07-01 14:25:15"
Follow these steps to configure the parameter(s) for an Date
validation rule:
From the Select drop-down menu in the Validation Rules setting, select Date. The
Date
validation rule has no parameters.
Email
Use the Email
validation rule to validate that the value entered into this control is formatted as an email address.
Follow these steps to configure the parameter(s) for an Email
validation rule:
From the Select drop-down menu in the Validation Rules setting, select Email. The
EMail
validation rule has no parameters.
In
Use the In
validation rule to validate that the value entered into this control exactly matches the given parameter setting. The validation rule evaluates the entire value entered in the control and considers case-sensitivity and empty spaces. The control's scope of evaluation may be within an array or a string. See In
Validation Rule Examples.
Follow these steps to configure the parameter(s) for an In
validation rule:
From the Select drop-down menu in the Validation Rules setting, select In. The Values parameter setting displays.
In the Values parameter setting, enter the value to evaluate if it exactly matches the control's selected or entered value. This is a required setting.
Format a list in the Values parameter setting by separating the values with commas only, no spaces:
value1,value2,value3
In
Validation Rule Examples
In
Validation Rule ExamplesThe following JSON Request data represents the JSON array for a Select List control under evaluation.
The Select List control contains the following settings:
This control is configured to return the value of the property
name
. Therefore, the doctors' names display as options in the Select List control.This control has an
In
validation rule to evaluate ifMindy Smith
is included in that control's selection.
If the Request participant selects the Mindy Smith option from that Select List control, then that control passes validation.
Max Length
Use the Max Length
validation rule to validate that the value entered into this control is no greater than a specified length.
The Max Length
validation rule evaluates the following:
a maximum number of characters in a string
a maximum integer value
a maximum file size
The Max Length
validation rule does not evaluate calendar dates, such as when an entered value in that control is no later than a particular date.
Follow these steps to configure the parameter(s) for a Max Length
validation rule:
From the Select drop-down menu in the Validation Rules setting, select Max Length. The Max Input parameter setting displays.
In the Max Input parameter setting, enter the numeric value that this control's value must be equal to or no greater than. This is a required setting.
Min Length
Use the Min Length
validation rule to validate that the value entered into this control is no less than a specified length.
The Min Length
validation rule evaluates the following:
a minimum number of characters in a string
a minimum integer value
a maximum file size
The Min Length
validation rule does not evaluate calendar dates, such as when an entered value in that control is no earlier than a particular date.
Follow these steps to configure the parameter(s) for a Min Length
validation rule:
From the Select drop-down menu in the Validation Rules setting, select Min Length. The Min Input parameter setting displays.
In the Min Input parameter setting, enter the numeric value that this control's value must be equal to or no less than. This is a required setting.
Not In
Use the Not In
validation rule to validate that the value entered into this control does not match the given parameter setting. The validation rule evaluates the entire value entered in the control and considers case-sensitivity and empty spaces. The control's scope of evaluation may be within an array or a string. See Not In
Validation Rule Examples.
Follow these steps to configure the parameter(s) for a Not In
validation rule:
In the Values parameter setting, enter the value to evaluate if it is not within the control's selected or entered value. This is a required setting.
Format a list in the Values parameter setting by separating the values with commas only, no spaces:
value1,value2,value3
Not In
Validation Rule Examples
Not In
Validation Rule ExamplesThe following JSON Request data represents the JSON array for a Select List control under evaluation.
The Select List control contains the following settings:
This control is configured to return the value of the property
name
. Therefore, the doctors' names display as options in the Select List control.This control is configured to allow multiple selections.
This control has a
Not In
validation rule to evaluate ifMindy Smith
is not included in that control's selection.
If the Request participant selects multiple options from that Select List control, but the Mindy Smith option is not among them, then that control passes validation.
Regex
Use the Regex
validation rule to validate that this control's value contains content as determined by a specified regular expression. A regular expression, abbreviated as regex, is a sequence of letters and symbols that defines a logical search pattern from which to search this control's content to validate that strings meet the defined pattern. This validation rule is useful to parse the contents of a control's value even if that control's Request variable contains programming code such as HTML or JSON.
Follow these steps to configure the parameter(s) for a Regex
validation rule:
In the Regex Pattern setting, enter the regular expression from which to validate this control's value contains that content. This is a required setting.
Required
Use the Required
validation rule to validate that this control has a value and is not empty.
A control constitutes as having no value in the following circumstances:
The value is
null
.The value is an empty string that contains no characters.
The value is an empty JSON array or empty JSON object.
The value is an uploaded file with no path.
Follow these steps to configure the parameter(s) for a Required
validation rule:
From the Select drop-down menu in the Validation Rules setting, select Required. The
Required
validation rule has no parameters.
Required If
Use the Required If
validation rule to validate that this control has a value and is not empty if another control in that Screen page contains a specific value. If the control being monitored contains a specific value, then the control under evaluation is required. See Required If
Validation Rule Examples.
The Required If
validation rule is the inverse of the Required Unless
rule.
A control constitutes as having no value in the following circumstances:
The value is
null
.The value is an empty string that contains no characters.
The value is an empty JSON array or empty JSON object.
The value is an uploaded file with no path.
Follow these steps to configure the parameter(s) for a Required If
validation rule:
In the Variable Name parameter setting, enter the Variable Name setting value to monitor for its value. This is a required setting.
In the Variable Value parameter setting, enter the value that must be entered into that control to make this control required. This is a required setting.
Required If
Validation Rule Examples
Required If
Validation Rule ExamplesA Request participant enters information into a Task for a job application. If that Task assignee selects from a Select List control in which country that person lives. If the Task assignee selects the option United States (US), then another Select List control becomes required to select from which US state that person lives.
This example demonstrates depending controls: one control depends on another to be required. This example also demonstrates how a control depends on the specific value of another.
See the following .json
files below for this example:
List of countries in JSON format: Countries for Select List Control "Required If" Validation Example
List of US states and territories in JSON format: US States for Select List Control "Required If" Validation Example
Follow these steps to implement this example:
Add a Select List control to your Screen, and then configure its settings. Make note of its Variable Name setting value you set for that control. This control displays the list of countries as its options.
Provide the options for this Select List control. In doing so, edit options as JSON:
Download the file below Countries for Select List Control "Required If" Validation Example.
Review the JSON data. Notice that each JSON object contains the following:
content: A property called
content
represents the label for each option (in this example, a country name). The label for each Select List option may contain any string as long as it is in thecontent
property of each JSON object.value: A property called
value
that contains a numeric value that corresponds with each label option. Thevalue
property may contain any string as long as it is in thevalue
property of each JSON object. Notice that the JSON object that contains thecontent
property value ofUnited States
has a value property of232
. In this example, if the option corresponding with the232
value is selected, then the second Select List control is required.
Copy this file's JSON data.
Paste it into the JSON Data setting.
Add a second Select List control to the same Screen page, and then configure its settings. This control displays the list of US states and territories as its options, and represents the required control if a specific setting in the first Select List control contains a specific value.
Provide the options for this Select List control. In doing so, edit options as JSON:
Download the file below US States for Select List Control "Required If" Validation Example.
Copy this file's JSON data.
Paste it into the JSON Data setting.
Add a
Required If
validation rule to the second Select List control that displays the list of US states and territories.In the Variable Name setting of the
Required If
validation rule, enter the Variable Name setting value for the first Select List control that displays the list of countries as its options.In the Variable Value setting of the
Required If
validation rule, enter232
, which is thevalue
property value that corresponds with thecontent
property valueUnited States
.Add a Submit Button control to the same Screen page, and then configure its settings.
Required Unless
Use the Required Unless
validation rule to validate that this control has a value and is not empty unless another control in that Screen page contains a specific value. If the control being monitored for its value has a specific value, then the control under evaluation is not required. See Required Unless Validation Rule Examples.
The Required Unless
validation rule is the inverse of the Required If
rule.
A control constitutes as having no value in the following circumstances:
The value is
null
.The value is an empty string that contains no characters.
The value is an empty JSON array or empty JSON object.
The value is an uploaded file with no path.
Follow these steps to configure the parameter(s) for a Required Unless
validation rule:
In the Variable Name parameter setting, enter the Variable Name setting value to monitor for its value. This is a required setting.
In the Variable Value parameter setting, enter the value that must be entered into that control to exempt this control from being required. This is a required setting.
Required Unless
Validation Rule Examples
Required Unless
Validation Rule ExamplesA Request participant enters information for a Task regarding United States (US) federal taxes. If that Task assignee selects from a Select List control that person lives in California, then that person is exempt from a federal tax credit. If the Task assignee selects the option California, then a Line Input control becomes required to enter tax information. If any other option is selected, then the Line Input control is not required.
This example demonstrates depending controls: one control depends on another to be required. This example also demonstrates how a control depends on the specific value of another.
See the following .json
file below for this example: US States for Select List Control "Required Unless" Validation Example.
Follow these steps to implement this example:
Add a Select List control to your Screen, and then configure its settings. Make note of its Variable Name setting value you set for that control. This control displays the list of US states and territories as its options.
Provide the options for this Select List control. In doing so, edit options as JSON:
Download the file below US States for Select List Control "Required Unless" Validation Example.
Review the JSON data. Notice that each JSON object contains the following:
content: A property called
content
represents the label for each option (in this example, a US state or territory). The label for each Select List option may contain any string as long as it is in thecontent
property of each JSON object.value: A property called
value
that contains a numeric value that corresponds with each label option. Thevalue
property may contain any string as long as it is in thevalue
property of each JSON object. Notice that the JSON object that contains thecontent
property value ofCalifornia
has a value property of6
. In this example, if the option corresponding with the6
value is selected, then the Line Input control is not required.
Copy this file's JSON data.
Paste it into the JSON Data setting.
Add a Line Input control to the same Screen page, and then configure its settings. The Request participant enters into this control required information unless a specific setting in the Select List control contains a specific value.
Add a
Required Unless
validation rule to the Line Input control control.In the Variable Name setting of the
Required Unless
validation rule, enter the Variable Name setting value for the Select List control that displays the list of US states and territories as its options.In the Variable Value setting of the
Required Unless
validation rule, enter6
, which is thevalue
property value that corresponds with thecontent
property valueCalifornia
.Add a Submit Button control to the same Screen page, and then configure its settings.
Same
Use the Same
validation rule to validate that the value entered into this control matches the value of a specified control.
Follow these steps to configure the parameter(s) for a Same
validation rule:
In the Variable Name parameter setting, enter the Variable Name setting value to evaluate if the control under evaluation matches its value. This is a required setting.
URL
Use the URL
validation rule to validate that the value entered into this control is formatted as a Uniform Resource Locator (URL).
Follow these steps to configure the parameter(s) for a URL
validation rule:
From the Select drop-down menu in the Validation Rules setting, select URL. The
URL
validation rule has no parameters.
Related Topics
Screen TypesScreen Builder ModesValidate Your ScreenEdit Your ScreenBootstrap Component Control SettingsBootstrap Wrapper Control SettingsCheckbox Control SettingsDate Picker Control SettingsFile Download Control SettingsFile Upload Control SettingsGoogle Places Control SettingsImage Control SettingsLine Input Control SettingsLoop Control SettingsMulticolumn / Table Control SettingsNested Screen Control SettingsPage Navigation Control SettingsPhoto/Video Control SettingsRecord List Control SettingsRich Text Control SettingsSelect List Control SettingsSignature Control SettingsSubmit Button Control SettingsTextarea Control SettingsLast updated