I’d like to know how I can block form submissions using public emails and only let through submissions that use a work email. I’ve copied some code of this article however I’ve just seen a form submission go through despite using a gmail.com email.
The concerned page is a Collection page that serves as a template for all of our company’s whitepapers. I’ve implemented the code suggested by the article in the page before the /body tag.
If not possible to filter public emails, I’ll probably just switch to an embedded Hubspot form and rely on Hubspot’s blocking list. However, I did enjoy the idea of being able to add and remove domains manually to the blocking list, something that Hubspot unfortunately doesn’t allow.
Can someone please let me know what is wrong, and how I could fix this ? Read-only link
The problem with using Regular Expressions or Javascript for this (the code in that linked thread) is that it’s easily bypassed by anyone and/or error prone as you’ve discovered.
I’d approach it differently but still keep the flexibility you’re looking for.
I’d send my form submission to a free Make.com (Integromat) account if you don’t already have one.
Then, have Make add it to Hubspot for me.
Lot’s of benefits taking this approach versus using a Hubspot form.
Here’s a quick overview:
Once it’s setup and you’re submitting native Webflow forms to Make, you can create a filter to only allow specific email domains to continue.
For example, I set one up to only allow emails from @nocodequest.com and block everything else.
Here’s what that looks like…
In the screenshot below you’ll notice the email submitted from my form meets that condition.
“Allow any email that has @nocodequest.com in it to continue with the workflow (regardless of upper or lower case entered by the user), otherwise block it and stop the workflow”.
When the filter blocks the workflow, it looks like the screenshot below.
Notice the workflow did not continue to the second module.
Have you tried using the HTML5 input pattern attribute?
In the designer, select your email input field and add this custom attribute;
Name: pattern
Value: ((?!@(gmail.com|yahoo.com|hotmail.com)).)*
Save and publish to staging on @webflow.io, and give it a try.
You should be able to enter any email, except those ending in @gmail.com, @yahoo.com, or @hotmail.com.
Add more to the list with another pipe and domain, e.g. |outlook.com.
Hi Michael, thank you so much for your incredibly helpful information. It’s been very effective! I do have a question: is it possible to allow emails only for individuals who are part of our company?