Field Masks

Forms are often used to collect information that comes in standardized formats, such as phone numbers. Field masks enforce special formatting for field values like phone numbers and social security numbers. Used with either a simplified syntax for creating masks or regular expressions, they can make it easier for users to enter the right values in a field and see those values in a useful or familiar way.

Simplified Syntax Field Masking

Easily implement simple yet customizable masks for various data types such as phone numbers, social security numbers (SSNs), dates, and currency. This format reduces the need for users to understand default regular expression error messages or for designers to maintain custom error messages.

Input mask characters

Mask character Character description
0 Any single digit, required. This element will accept any single digit between 0 and 9.
9 Any single digit or a space, optional.
# Any single digit, space, plus (+) or minus (-) sign, optional.
L Any single letter, required. This mask element is equivalent to [a-zA-Z] in regular expressions.
? Any single letter, optional. This mask element is equivalent to [a-zA-Z]? in regular expressions.
A Any single alphanumeric character, required. This mask element behaves similar to the "a" element.
a Any single alphanumeric character, optional. This mask element behaves similar to the "A" element.
\ Escape. Escapes a mask character, turning it into a literal. "\\" is the escape sequence for a backslash.

Examples

Use case Masking syntax
US format phone number (000) 000-0000
International format phone number 000-000-000-0000
Social Security Number 000-00-0000
Canadian Postal Code L0L 0L0

 

Regular Expressions

Social Security numbers

The standard Social Security number (US) format is: xxx-xx-xxxx, which is represented by the regular expression \d\d\d-\d\d-\d\d\d\d. You can use this regular expression along with a field mask to make it easier for users to enter numbers without having to worry about the dashes.

  1. On the Layout page of the form designer, add a single line field to the canvas. Select the field and click Edit, then click the Advanced tab.
  2. Next to Regular expression, enter \d\d\d-\d\d-\d\d\d\d.
  3. Click Done.

Phone numbers

The standard phone number format (US) is (xxx)xxx-xxxx, which is represented by the regular expression \(\d\d\d\)\d\d\d-\d\d\d\d. You can use this regular expression along with a field mask to make it easier for users to enter a phone number without having to worry about the parenthesis and dashes.

  1. On the Layout page of the form designer, add a single line field to the canvas. Select the field and click Edit, then click the Advanced tab.
  2. Next to Regular expression, enter \(\d\d\d\)\d\d\d-\d\d\d\d.

  3. Click Done.