Input Mask options are available under the General Settings panel, and only for the Single Line Text field and the Post Custom Field. They can provide more granular control over the permitted entry formats than the standard fields such as Phone Number or Address Postal Code.
Standard Input Masks
Standard input masks provide a variety of common United States input formats to choose from. The choices are offered as standard are listed below. In all cases, any non-numeric digits are auto-inserted (e.g. the spaces, parentheses, dashes, etc.)
Standard Option | Pattern Offered |
---|---|
US Phone | Standard US formatted phone number. (###) ###-#### |
US Phone + Ext | Standard US formatted phone number with business style extension of up to 5 digits. (###) ###-#### x##### |
Date | US style mm/dd/yyyy numeric date format. ##/##/#### |
Tax ID | US style tax identification number. ##-####### |
SSN | US style special security number. ###-##-##### |
Zip Code | US style zip code format ##### |
Full Zip Code | US style zip+4 format. #####-#### |
Custom Input Masks
Input masks provide a visual guide allowing users to more easily enter data in a specific format such as dates and phone numbers. The input mask in the image above allows the user to add two digits for the month, two digits for the day, and four digits for the year. No letters or any other characters will work, only numbers.
Accepted Input Mask Characters
The following symbols are accepted as placeholders in input masks and provide some basic pattern matching.
Symbol | Meaning |
---|---|
9 | Accepts any numeric character |
a | Accepts any alphabetic character (must be lower case) |
* | Accepts any single alphanumeric character. |
? | Indicates that all characters defined by the mask after the question mark are optional. |
any other | All other characters are literal values and will be displayed as is. |
Notes
- A customer will only see underscores when they enter the field, which identifies the quantity of characters the field expects, but not their type. We recommend you provide additional visual help for complicated masks, such as a field description or a placeholder example.
- If the “Enable password input” advanced property is checked, it will override the input mask functionality.
- To create your own custom input mask to be used repeatedly, you can use the gform_input_masks filter.
Examples
Here are some sample masks, and what an accepted input would be.
Date mask: 99/99/9999
→ would accept 05/21/2011
or 21/05/2011
, but not 05/21/11
and not 5/21/2011
Social security mask: 999-99-9999
→ would accept 987-65-4329
but not 800-555-FORM
Code mask: aaa 999
→ would accept BIO 101
but not B1O 5F0
Key mask: ***-***-***
→ would accept a9a-f0c-28Q
US Zipcode+4 mask: 99999?-9999
→ would accept 23462
or 23462-4062