MaskedField
Basics
MaskedField
repeats the functionality of TextField, but it is convenient to use MaskedField
for dates, social security numbers, tax IDs, and phone numbers, for example:
<layout spacing="true">
<maskedField id="maskedField"
caption="Phone number"
mask="(###) ###-##-##"/>
</layout>
Attributes
mask
The mask
attribute allows you to set a mask for the field. You can use the following characters:
-
#
– number -
U
– uppercase letter -
L
– lowercase letter -
?
– letter -
А
– letter or number -
*
– any character -
H
– uppercase hex character -
h
– lowercase hex character -
~
– plus (+
) or minus (-
) character
valueMode
The valueMode
attribute allows you to define a format of a returned value (with a mask or not). This attribute can take two values:
-
clear
- sets by default. For the example above, the returned value will be9967467927
. -
masked
- for the example above, the returned value will be996-746-79-27
.
Events and Handlers
To generate a handler stub in Jmix Studio, select the component in the screen descriptor XML or in the Jmix UI hierarchy panel and use the Handlers tab of the Jmix UI inspector panel. Alternatively, you can use the Generate Handler button in the top panel of the screen controller. |
EnterPressEvent
See EnterPressEvent.
Validator
See Validator.
ValueChangeEvent
See ValueChangeEvent.
MaskedField XML Attributes
You can view and edit attributes applicable to the component using the Jmix UI inspector panel of the Studio’s Screen Designer. |
align - box.expandRatio - buffered - caption - captionAsHtml - colspan - contextHelpText - contextHelpTextHtmlEnabled - css - dataContainer - datatype - description - descriptionAsHtml - editable - enable - height - htmlSanitizerEnabled - icon - id - mask - property - required - requiredMessage - responsive - rowspan - stylename - tabIndex - valueMode - visible - width