Hi, I need a validation that the user can enter only numbers from 01-99 . How can we do this?Is there any range function or limit function to check it?
Discussion posts and replies are publicly visible
Assuming the field you're using to capture the data is an Integer field you can write a validation on that field:
{ a!integerField( label: "Integer", labelPosition: "ABOVE", value: ri!myInteger, saveInto: { ri!myInteger }, refreshAfter: "UNFOCUS", validations: { if( fn!or( ri!myInteger<0, ri!myInteger>99 ), "Invalid value - out of range (0-99)", null ) } ) }
I use a text field and user can enter a value a list from 01-99. Is it possible to use regexallmatches for this to validate and get the correct values
As long as you can find the correct RegEx expression then yes. I would encapsulate the RegEx in a separate Expression Rule so you can test it independently from the User Interface, and then simply incorporate it into the Interface when it's ready.
hema.mathivathanan said:user can enter a value a list from 01-99
This is a bit different from what you wrote originally - can you clarify (which you should have done initially), EXACTLY what the user is expected to be typing in their text field, including not only the values but the manner by which they will be SEPARATING the individual values they enter, etc? This is an intricate question, and so in order to provide a correct answer, we really need these details up-front without having to try one solution only for you to clarify that the real question was something rather different....
Hi Mike, sorry about the confusion.First my question is for the limit. Then later I wanted to know in case if there is a list of values, can we used regex function
Other options:
Sorry but it all needs to be answered at once for the most part. If you just want "a limit" then Stewart's initial answer (among other potential simpler solutions) would be just fine. Allowing users to enter a list of valid values completely changes the nature of the problem, because you need to deal with parsing a list, forcing users to enter a delimiter of some sort (or using an alternative type of field as Stewart suggests above), and other such questions.