Hi
I am working in version 19.3.
I have two requirements:
1. In a text field, user is able to enter only alphanumeric characters and no special characters.
For eg: User can enter the values- 1235678901, 12A3178R9, 12ru38901, u189132W9
2. In a text field, user can enter alphanumeric value of the form: 2 alphabets, 6 numbers, 1 alphabet. For eg: AG124567UP, ar781329kw, yT893052eR
I need to put validations on my text field, if user enters rather than expected values in both the cases.
If I had the restriction that user can enter only numeric value in the text field, then I would have used stripwith():
a!localVariables( local!inputValue, a!textField( label:"Test Value", value:local!inputValue, saveInto:local!inputValue, validations: if( rule!APN_isBlank(local!inputValue), "", if( rule!APN_isBlank(stripwith(local!inputValue,"1234567890")), "", "The value provided is not a valid number" ) ) ) )
Any suggestions please.
Thanks in advance!!
Discussion posts and replies are publicly visible
I second Bhanu - Regex is definitely the way to go. With the right pattern it will provide the precise validation you're after with minimal effort.