How Can We Help?

Validate email addresses

You are here:
< All Topics

Scenario

Let’s say that you have a field named  ‘Email’ which you use to capture an email address and you want to ensure that users enter a valid email address.

Solution

This can be accomplished by adding a simple rule within the Logic screen that validates the contents of the ‘Email’ field.

  1. Title: Email format validation
  2. Conditions: Custom js function
  3. Steps: Field – set custom error

 

Code

let emailRegExp = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/g;
getValue('Email').match(emailRegExp) == null​

 

Example

 

Once you have configured this it should work like this:

 

 

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Table of Contents