Validate email field

Hello, I have a form that permits insert an email address in DB.
I’d like to deny address who have @gmail.com or @yahoo.com on their name.

I did some tests with “Validate” server side. The best thing I can do is logout if the text of $POST(“email”) contains @gmail.com
I also tried REDIRECT (it would also be fine, I create an error page, but the redirect doesn’t work!)

errore

Thanks

Any ideas for me? thanks

You can use regex validation on your page and use something like:

^[a-zA-Z0-9_.+-]+@(?!gmail\.com|yahoo\.com)[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$

as an expression to exclude these.

1 Like

If you want to do this check on the server side, then you can indeed use a condition and check if the $_POST var contains @gmail.com or @yahoo.com and then use the response step to return some 4xx error.

It works. Thanks!