How do I validate an e-mail address?

To validate that an email address is well formed, please follow the instructions below.

STEP 1: Navigate to the Form Properties page of your form.

STEP 2: Place the following function in the JavaScript field.


function validateEmail(emailVal) {
var re = /^(([^<>()[\]\\.,;:\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,}))$/;
return re.test(emailVal);


STEP 3: Create an email element with a data column name of email.

STEP 4: In the Dynamic Value field of the email element put email="".  This sets the element to an empty string.

STEP 5: In the Client Validation field of the email element put validateEmail(email) || email=="".

STEP 6: In the Validation Message field of the email element, enter your validation message.  Example: "Please enter a valid e-mail address to submit"

STEP 7: Test the Client Validation on the form.





    Was this article helpful?
    0 out of 0 found this helpful
    Have more questions? Submit a request


Powered by Zendesk