How to validate TextBox

I want to check if the name, email, password, etc … really is a name, email, password, etc …!
To do this I would like to check that the fields do not have prohibited characters like: # ! = ? & % , + - ( ) { } ` ’ ´ ^ ~ « » º ª < > ; \ | / *
But for that I have to add several “contain text piece” within several “or” for each character! And then all over again for each textbox!
This, besides taking forever, is also very inconvenient! There must surely be another way of doing this that I am not aware of.
Can someone help me?

You can do it like this:
1.Make a list of invalid characters.
2.Run for loop and check if that particular item is in text or not.If it is in text then store yes else no.
3.When loop ended show result yes or no.

2 Likes

for the email, you could use the EmailAddressIsValid method from the tools extension

for the other requirements you could use the Matches method from the tools extension together with a RegEx of your choice

Taifun

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.