Verify Email is valid on form submit

Hey guys!

We have multiple LPs with email opt in to download a lead magnet, however they are able to use nonvalid emails.

Is there some custom code of custom attributes I could use to help validate emails upon submission?

I’ve tried a few options such as name = pattern value = ?:[a-z0-9!#$%&'+/=?^_{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_{|}~-]+)|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|[\x01-\x09\x0b\x0c\x0e-\x7f])")@(?:(?:a-z0-9?.)+a-z0-9?|[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-][a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|[\x01-\x09\x0b\x0c\x0e-\x7f])+)])

which resulted in an error and the below which did not work and showed the code at the top of the page.

function IsEmail(email) {
        var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        if(!regex.test(email)) {
           return false;
        }else{
           return true;
        }
}

$('input[type=email]').on('input', function(){
        IsEmail($(this).val())
})

Thank you in advance!

Here is my site Read-Only: (Webflow - pancham test)

Hey Victoria,

If you’re looking for basic “shaped like a modern email” validation, you can do it with a pattern.
I’ve written up a guide here;

If you’re looking for more advanced validation that verifies the server, checks that it has email, queries for an account response… there are 3rd party services that can do that. You could integrate that through automation like Make.

Logic should be able to provide round-trip integration as well too soon I’d imagine.

This works! Thank you!