Streaming live at 10am (PST)

Custom Code for Email Validation not working

Hi Webflow Community,

I want to have stronger email form validation on my website, which allows people to sign up for our newsletter. Right now, if you put “name@gmail,” you can still submit the form.

I was given this custom code snippet, but after I embedded it onto my email form on my project, it still didn’t work. I could still put in "name@gmail and submit the form.

I’m wondering if there is anything I need to change in the custom code snippet to make it work. Otherwise, did I embed it to the wrong side of the form?

I decided to remove the custom code embedded into my project for now, but I’d love to hear what I may be doing wrong. If anyone else has other resources for custom code they’d used, I’d be really glad.


Here is my site Read-Only: [LINK][1]

[Custom Code Used] Form Email Verification w/ Disabled Enter Key — Lumen

Since email@localdomain is a valid email address, there is really no point in trying to override the default behavior of the HTML5 email input field. Whenever you try you will inadvertently block submissions that may be valid.

Hi Jeff! I actually got the link to this custom code from the Webflow team to have stricter form validation. I think it does more than just reject (email@localdomain) emails. It seems like it has a way to check which are valid or not.

I’m struggling with the implementation with the code. Right now, the only validation I have is making the form “email form” instead of a “text form”. I think this would be a great way to make it stricter, so less typos will be input (name@gmail).

Thank you so much for your response!

This script just uses regular expressions to compare the email input field contents to a regular expression that attempts to “catch” email addresses that don’t meet its conditions. This issue is do you know what those are? It does not “verify” nor can it confirm validity.

My preference is just use the standard input email field which is already designed to check for valid addresses, then review or automatically spam check the actual submission. If you inadvertently block a potential client at the front end you won’t even know. I can’t afford to do that with my clientele since many are paying for landing page traffic and each lead represents a significant spend.

If you are trying to deal with spam, then using another service for form processing is a better choice. Webflow has ZERO checks on submissions.

As to the second part where you indicate you are struggling, sorry but I am not following you. Can you provide more clarification?