About validation properties
Validation properties are available for input fields to allow you to define validation rules in your App.
A set of common validation patterns are defined in the Choose common pattern drop-down list where you can set the expected input data type for the field, such as digits, letters, email, URLs. A standard default message is displayed when the user enters data in the field that does not match the predefined pattern. See Available common pattern for a description of each common pattern, and see Common pattern regular expressions for details on the validation patterns used for these.
You can also use Liquid templating to define additional optional validation rules for a required field, as well as rules for error, warning and information messages. For example, when entering credit card information, a certain field could be set to be required when Payment method was set to Credit Card and you would define a Required rule for this; or a Card number field might have Digits selected as the common pattern and an additional error rule defined that only allows 16 digit numbers.
Note that if overlapping validation conditions occur, then the hierarchy is: Required > Common pattern > Error > Warning > Informative.
Available common patterns
The following table lists the available common pattern options and provides examples of valid and invalid input:
|None||Does not match any string and is used when no pattern is required.|
|Number (negative and decimals||Matches any valid number, including negative numbers and decimals.|
|Digit||Matches any positive integer (that is, numbers without decimals or negatives).|
|Word (only alphanumeric)||Matches any word that contains only alphanumeric characters (that is, letters and numbers).|
|Word (special characters allowed)||Matches any word that contains alphanumeric characters as well as certain special characters such as periods, commas, and semicolons.|
|Text||Matches any string that contains alphanumeric characters, spaces and certain special characters such as periods, commas, and semicolons.|
|Letter||Matches any single letter (uppercase or lowercase) as well as certain letters in Spanish, such as ñ, á, é, í, ó, and ú. Note that if you need to have a pattern rule for other characters, for example Nordic characters, then you can do this by creating an additional validation pattern using Liquid templating for the Error rule.|
|Matches any valid email address.|
|URL||Matches any valid URL, including protocols such as http, https, ftp, mailto, etc.|
|Date: mm/dd/yyyy||Matches any date in the format MM/DD/YYYY (month/day/year) where MM is the month in two digits, DD is the day in two digits, and YYYY is the year in four digits.|
|Date: dd/mm/yyyy||Matches dates in the format dd/mm/yyyy, where dd is the day (01-31), mm is the month (01-12), and yyyy is the year (for example 2022). The pattern matches only if the day and month values are within their respective ranges, and the year value consists of four digits.|
|Time 12H: HH:MM AM/PM||Matches times in 12-hour format, with an optional space and either "AM" or "PM" at the end. The pattern matches if the hour value is either "00", "12", or a value between 1-11 (with or without a leading zero), and the minute value is between 00-59. The optional space and AM/PM values are matched using regular expression alternation.|
|Time 24H: HH:MM:SS||Matches times in 24-hour format, with hours in the range 00-23 and minutes and seconds in the range 00-59. The pattern uses grouping and repetition to ensure that the minute and second values each consist of two digits.|
|Strong password||Matches "strong" passwords that meet the following criteria:
- at least 8 characters long
- contains at least one uppercase letter
- contains at least one lowercase letter
- contains at least one digit
- contains at least one special character from the given set.
The pattern uses positive lookahead assertions to check for the presence of each required character type, and a character class to match any of the allowed special characters.
|IPv4||Matches valid IPv4 addresses that consist of four decimal numbers separated by periods. Each decimal number must be in the range 0-255, with the exception that leading zeroes are not allowed (for example, 01). The pattern uses alternation to match any of the four possible formats for a decimal number (that is, a single digit, two digits starting with 1, two digits starting with 2-9, or three digits starting with 1).|
|IPv6||Matches valid IPv6 addresses that consist of up to eight groups of four hexadecimal digits separated by colons. The pattern uses grouping and repetition to match each group, with an optional space between groups. The pattern allows for leading zeroes and both uppercase and lowercase hexadecimal digits.|
Common pattern regular expressions
The following table shows the defined regular expressions for the available common patterns:
|Pattern||Validation regular expression|
|Number (negative and decimals allowed)||
|Word (only alphanumerical)||
|Word (special chars allowed)||
|Time 12H: HH:MM AM/PM||
|Time 24H: HH:MM:SS||