Masked text field
A text field of type String have additional property to allow you to specify an input mask.
Input masks provide a set format for data entry in a field by using characters and symbols. The input data in that field must follow the pattern defined by the input mask.
When you have several people entering data, masking a field helps maintain consistency and prevents users from entering invalid data.
The following characters are used to specify the mask.
Character | Name | Description |
---|---|---|
0 | Digit | Accepts any digit between 0 and 9. |
9 | Digit or space | Accepts any digit between 0 and 9 or space. |
# | Digit or space | Like 9 rule, but allows also (+) and (-) signs. |
L | Letter | Restricts input to letters a-z and A-Z. |
? | Letter or space | Restricts input to letters a-z and A-Z. |
& | Character | Accepts any character. |
C | Character or space | Accepts any character. |
A | Alphanumeric | Accepts letters and digits only. |
a | Alphanumeric or space | Accepts letters, digits and space only. |
-
You can use mask characters as literals by prefixing the mask character with '\'.
-
The '\' character can itself be used by entering '\\' in the mask. For example, (000) 000-0000 \\ 999.
-
Optional characters can be left blank. When getting the value, these optional characters are represented as a space.
-
Values that do not satisfy the mask (when required characters have not been entered) result in clearing the field when tabbing off the field. Therefore the user can never enter invalid data.
-
Missing optional characters do not clear the field.