Our thanks goes to Rocketgenius (the team behind Gravity Forms) for this information, which we have shared here for ease of reference.
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.
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