The "Masked Input" control type extends the GeneXus Edit control, adding on the fly user input formatting. You can select this control type using a ControlInfo node.
The value is formatted using a mask that must be provided by the developer.
This control:
- Automatically adds formatting characters as defined by the mask.
- Ignores characters entered by the user that do not match the mask definition.
Common scenarios for this control type are:
- Formatting government-issued documents.
- Formatting phone numbers.
- Formatting ZIP codes.
- Formatting license plates.
If you wish to format a numeric value that should be processed as a number and not an "identifier" (as in the cases shown above), we recommend checking out the Numeric input control type. Using that control it is not necessary to define the mask: it is inferred automatically from the field's definition.
The mask must be provided by the developer using the "Mask" property. That property stores a string with the format in a manner similar to the Picture property in GeneXus.
The rules used when interpreting the maks are detailed below:
9 |
A number must be entered in this position |
Z |
A number may (optionally) be entered in this position |
A |
A letter must be entered in this position |
B |
A letter may (optionally) be entered in this position |
X |
A number or letter must be entered in this position |
; |
This symbol may be used to separate masks when more than one mask can be used in the field. For example, "999;9AA" means that the value may be composed of three numbers or a number followed by two letters. |
\ |
This symbol may be used to escape the previous symbols (and itself) so that they are processed literally if the desired format contains any of these symbols literally |
Generic |
Credit card |
9999 9999 9999 9999
|
Credit card expiration |
99/99 |
IP Address |
ZZ9.ZZ9.ZZ9.ZZ9
|
Brazil-specific |
CNPJ |
99.999.999/9999-99
|
CPF |
999.999.999-99
|
CNPJ or CPF |
999.999.999-99;99.999.999/9999-99
|
Uruguay-specific |
CI |
ZZZ.ZZZ.ZZ9-9 (is Numeric Mask = True) |
Property |
Description |
Mask |
Contains the mask definition |
Is Numeric Mask |
Indicates if the mask must be treated as a number or not. If set to true, the field will be right aligned and the mask will be applied from the right to the left. |
Casing |
Can be set to Uppercase if the developer wishes that the casing entered by the user be ignored and uppercase letters be shown always. |
Output Value |
Determines if the value returned by the control should include the mask or should be the raw value entered by the user. |
FormattedValue: Can be used to retrieve the value entered the user after applying the format, regardless of the Output Value property.
UnformattedValue: Can be used to retrieve the value entered the user before applying the format, regardless of the Output Value property.
When using this control type, the "Invite Message" property has no effect on the control's UI.
|