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 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.
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.
- 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.
- Next to Regular expression, enter \d\d\d-\d\d-\d\d\d\d.
- 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.
- 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.
- Next to Regular expression, enter \(\d\d\d\)\d\d\d-\d\d\d\d.
- Click Done.