9
Views
2
Comments
[Input Mask React] max value validation with input mask react not working
Question
inputmask-react
Reactive icon
Forge asset by João Barata
Application Type
Reactive
Service Studio Version
11.55.38 (Build 64325)

Hi

I am having a normal input field with min=1 and max=9999 attributes set. It works fine with validation. 

Now I add input mask react on top of it for formatting, however the max validation fails. If  I enter 10000, the value is accepted without error. 

How can I enforce max validation by using input mask react.

2019-11-11 17-10-24
Manish Jawla
 
MVP

Hi @Pavithra Balasubramanian ,

In OutSystems, once you add an input mask the normal min/max checks stop working because the field is treated like text. To keep values between 1 and 9999, you have two simple choices. The easiest is to set the mask itself with Min = 1 and Max = 9999 (in the block settings or advanced options), so it won’t let users type numbers outside that range. If your mask doesn’t have those options, just add a validation: when the input changes or the form is submitted, check the number and show an error if it’s not within 1–9999. This way the rule always applies, no matter how the number is formatted. 

regards,

Manish JAwla

UserImage.jpg
Pavithra Balasubramanian

Thanks for your clarification Manish. 

However I see no advanced options exposed from mask block. Hence the only way is to impose a manual validation. 

Regards

Pavithra

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.