Published
November 23, 2022
Updated
Sometimes, you want to block non-work email addresses, from free providers, since they're more likely to be "throwaway" addresses.
A full implementation of this is a bit complex, but a basic implementation using Patterns is easy;
So how do we prevent that?
In addition to setting the field type to email, add the following custom attribute;
pattern = ((?!@(gmail.com|yahoo.com|hotmail.com)).)*
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.
Best Practices
Combine techniques;
- In Webflow's Designer, set the input type to email
- Also add the custom pattern
- Optionally, make the field required