How to restrict the input of textbox based on regular expression?

0
I have two textbox named street address and pin code. I want to restrict the input in that textfield based on regular expression. For example : user cannot enter anything excepts digit in pincode and no special characters is allowed in street address. Thanks in advance.
asked
2 answers
1

Hi,

The mendix approach is to define validation rules for entities, that apply to the attribute that the user is entering in the text field. You can find these validation rules if you go to the properties for an entity in the domain model

Note that the validation will only take place after the user clicks a button to submit the form, meaning he can still enter anything in the text field.

-Andrej

 

PS: Here is guide by mendix on data validation - https://docs.mendix.com/howto/data-models/setting-up-data-validation

answered
1

Hi Kavya,

 

You can use the input mask for this: https://docs.mendix.com/refguide/text-box#input-mask-only-in-web-forms.

The input mask limits what the user can enter in the text box. A ‘9’ means any digit, ‘Z’ means any letter, ‘U’ an upper-case letter, ‘L’ a lower-case letter and ‘*’ a letter or a digit. Other characters will be taken literally. For example, the input mask 99-LLL-9999 matches 24-apr-2008.

 

Hopes this help.

answered