Maksed Field in Jmix 2.x?

There is a masked field in V1. Is there any such component in V2? if not is there a way to implement it using text field?

Hi,

Text components have settings for Min & Max Length, Pattern, and Allowed Characters. By combining them, the mask behavior can be achieved and is actually more flexible. An example from the Vaadin docs:

TextField field = new TextField("Phone number");
field.setRequiredIndicatorVisible(true);
field.setPattern("^[+]?[(]?[0-9]{3}[)]?[-s.]?[0-9]{3}[-s.]?[0-9]{4,6}$");
field.setAllowedCharPattern("[0-9()+-]");
field.setMinLength(5);
field.setMaxLength(18);
field.setHelperText("Format: +(123)456-7890");

image

Alternatively, you can integrate (doc) the Input Mask Add-on based on imaskjs library.

Regards,
Gleb

2 Likes