Use the Format field option to make sure users provide information in the right format. This can range from phone numbers to postal codes to serial numbers, and much more! Below, you will find information on how to customize the format of a Single Line Text field and Phone Number field.
Please note: If the format option is left empty in a Single Line Text field, no extra validation will be applied. If the format field is left empty in a Phone Number field, the field will be validated to make sure a valid phone number has been entered.
Set a format with an input mask
You may use the format option to require a specific format and simultaneously apply an input mask. An input mask helps your users enter the correct format, as shown below:
How to set a specific format
Determine the format that will be accepted by following the directions below.
- Go into a Single Line Text or Phone Number field's options.
- Type the preferred format in the Format box.
- Save your form and preview it. When you put your cursor into the field, you will see the input mask appear. Users will only be able to enter characters that fit the saved format.
The following characters can be used in the Format settings:
- 9 - requires any numeric character
- a - requires any alphabetic character
- * - this is a wildcard; allows any character
- ? - makes the following characters optional
- Require a phone number in the (999)999-9999 format.
- Require a properly formatted social.
- Require 5-6 numbers.
- Require 4 alphabetic characters followed by any character.
Regular expression validation
If the standard format options don't offer the flexibility that you need, use a regular expression to completely customize the format validation. Insert a regular expression beginning with ^ in the Format box. Please note that this will not add an input mask to your field. It will simply make sure the entered values match the format in your regular expression. If the entered values don't match the format, an error will appear after the Submit button is clicked.
^[Expression body here]$
Please note that both the starting ^ and ending $ are required to treat the format as a regular expression. If you have questions about your regular expression, you can refer to many free regular expression devoted websites.
- Require 5-10 alphanumeric characters.
- Require 99.9999.9999 or 99.99999.9999 for the phone number format.
- Disallow certain characters. The following example will remove a, 1, ", and '.
- Only allow alphabetic characters.
- Allow 1-3 characters country code and 2-3 characters area code to create an international phone number format, e.g. Switzerland (+41-83-333-3333)
- Disallow a certain word. The following example will exclude the word mini.