In my form validation I already added stuff like the username already exists or it should be longer than n letters etc. but now I want to add more restrictions and display a message that says ‘username’ is invalid when it’s not in English or if it has stuff like underscores slashes etc. is there a way for me to do that?
2
Answers
For just the English Alphabets you need to set a regex for the alphabetical pattern checking. Create a static final field for the RegExp to avoid creating a new instance every time a value is checked.
And then to use it :
you can set textfields validations like this it will only except characters a to z. and add validation in textfield through this