I'm making a query site with an input field and 2 radiobuttons. When the "CPF" radiobutton is selected, only numbers can be entered. When the "Name" radiobutton is typed, only characters are allowed. I want to add min and max character size for both cases. When the radiobutton "CPF" is selected, I want a minimum limit of 11 characters and a maximum of 15. And when the radiobutton "Name" is selected, I want a minimum limit of 8 characters. How do I do this with input mask reactive?
Hello Vinicius,
From what I can see in the component, you can use the "Min" and "Max" properties to set those values.If you want them to be dynamic based on the selection, you can do something like this:So, if the user selects "CPF", you will have a minimum of 11 chars. and max of 15 chars. allowed.Hope this helps you.
Best regards,Fred
Hi Fred,
Thanks for the help
How do I activate this option? for me the min and max are disabled
follow image below:
Hello Vinicius,I think I spoke to soon there, the widget I was using was for number input.For the Pattern input, you can do something like this (reusing your regex expressions): TipoConsulta = "CPF", "^[0-9]{11,15}$"TipoConsulta = "nome", "^[A-Za-z ]{8,}$"I've replaced the "+" quantifier for {x,y} quantifier, see screenshot for short explanation:Hope it helps.Best regards,Fred
In my case I use only one mask for both filters, I put it in the model you passed but it ended up giving an error (nothing appears in the input field even writing it).
If(TipoConsulta="nome","^[A-Za-z ]{8,}$","^[0-9]{11,15}$")