An Edit Mask restricts what data can be entered into the User Field, which helps guide users through entering data correctly.
It is typically used for the Text, Date, Time, Date/Time user field types.
In the Setup User Field edit form, you define the Edit Mask by entering a combination of specially designated characters that specify what type of data can or must be entered, and in what pattern.
In this example, we are creating a "Registered Charity Number" User Field for the "Company" Data Type.
In the Setup User Field edit form, select a Field Type from the drop-down list. We have selected "Text".
There is a specific format required for the number, so we enter 000000000RR0000 in the Edit Mask field. This will require the user to enter a 15-digit alpha-numeric value that consists of 9 numbers, followed by the characters RR, and ending with 4 more numbers. (See the tables and examples at the bottom of this topic for commonly used edit masks).
Select an option from the Edit Mask Type drop-down list. The Edit Mask Types are explained below.
Figure 1028: Defining Edit Mask
Now we are in the User Fields form opened from the Company edit form.
We haven't entered values yet, but because the field is focused, you can see the required format for data entry.
Figure 1029: Viewing Edit Mask Before Entering Value
We have now entered a value in the User Field, following the format dictated by the Edit Mask.
Figure 1030: Entering Value in Field with Edit Mask
If you want to use an Edit Mask for the field, you need to select an Edit Mask Type (other than None).
The Edit Mask Types in the drop-down list will be different, depending on the Field Type selected.
For the Text field type, the available Edit Mask Type options are:
•Simple
•Reg Ex (Extended Regular Expressions)
•Regular (Simplified Regular Expressions)
For the Integer, Double, and Currency field types, the available Edit Mask Type option is:
•Numeric
For the Date Time and Date field types, the available Edit Mask Type options are:
•Date Time
•Date Time Advancing Caret
In DevExpress Documentation, the mask types are described as follows:
•Simple: “The Simple mask type allows users to enter alphabetic, numeric or alphanumeric characters at specific positions. For example, phone numbers, zip codes, and social security numbers.”
o"Use this mask type when an editor should accept values in a fixed format without alternatives (for instance, phone numbers or zip codes)."
•Extended Regular Expressions: “Extended regular expressions allow you to specify a pattern that the entered text should match. The syntax is similar to the POSIX ERE specification.”
o"Use these masks if an editor should do one of the following:
▪Accept values with a custom range of characters at a specific position (for instance, a 16-character license code where each character can be either a digit or a letter).
▪Accept values of an indeterminate length (for instance, an e-mail address).
▪Accept values that match any of the multiple allowed formats.
▪Auto-complete values entered by a user."
•Simplified Regular Expressions: “Simplified regular expressions allow you to specify the entered text’s pattern. Simplified regular expressions support backward compatibility with XtraEditors version 2. We recommend that you use the RegEx type syntax because it supports additional features like alternative validation and autocomplete.”
•Numeric: "The Numeric mask type allows users to enter numeric values (integer, float, currency, percentage, etc.). This mask type supports the standard numeric .NET format."
•DateTime: "The DateTime mask type allows users to enter a date and/or time."
o"Allows you to specify masks for date and time values. Uses the standard .NET numeric format for mask expressions."
•DateTime Advancing Caret: "This option specifies whether the caret moves to the next mask segment when the current segment is filled. For example, in the “d” mask (the “MM/DD/YYYY” date format) a user starts by entering a month number. When two digits are entered, the caret moves to the day number. Two more digits bring the caret to the last segment (year). This behavior allows users to quickly enter dates (for instance, type “11212020” to enter November 21, 2020). If this setting is disabled, a user stays on the day segment until they press the right arrow key to move the caret."
For further explanation, please view DevExpress Documentation. This topic may be a helpful starting point: https://docs.devexpress.com/WindowsForms/583/controls-and-libraries/editors-and-simple-controls/common-editor-features-and-concepts/input-mask
You can define an Edit Mask for Date, Time and Date/Time fields, using the Standard and Custom Date-Time specifiers described in the topic Display Format under User Field Definition Setup.
You can create an Edit Mask by combining the Metacharacters, Special Characters, and Literal Characters described in the table below:
Character |
Description |
Metacharacters: Used to represent a range of symbols. |
|
0 |
Digit must be entered (0 to 9). Plus (+) and minus (–) signs not allowed. |
9 |
Digit (0 to 9) or space can be entered. Plus (+) and minus (–) signs are not allowed. |
# |
Digit (0 to 9) or space can be entered. Plus (+) and minus (–) signs are allowed. |
L |
Letter (A to Z) must be entered. |
l |
Letter (A to Z) can be entered. |
A |
Letter or digit must be entered. |
a |
Letter or digit can be entered. |
C |
Any character or a space must be entered. |
c |
Any character or a space can be entered. |
Special Characters: Used to control the case of the input string, and represent delimiters. |
|
> |
Converts all characters that follow to uppercase. |
< |
Converts all characters that follow to lowercase. |
\ |
Metacharacters or special characters immediately following \ will be displayed literally. For example, \A is displayed as just the letter A, instead of being used to represent a required alphanumeric character. |
Literal Characters |
|
- ( ) . / Letters and Numbers that are not metacharacters (e.g. not A, a, L, l, C, C, 0, 9) |
These are literal characters. They will be inserted automatically into the field as determined by the edit mask. When entering a value in the field, the User will not have to enter these characters; the cursor will skip over them. |
The examples in the table below below are just a few ways of combining Metacharacters, Special Characters, and Literal Characters to control the values that can be entered in a Text user field.
Edit Mask |
Field without Value Entered |
Sample Value Displayed |
(000) 000-0000 |
||
000.AAA.AAAA |
||
L0L 0L0 |
||
000-00-0000 |
||
#999 (Optional + or -) |
||
000-0-00000-000-0 (ISBN 13) |
||
0-0000-00000 (ISBN 10) |
||
099.099.099.099 (IP Address) |
||
AAA\AB\C-000123 (Random Example) |