Question

Limit email field to receive only one domain


Badge

Hi, 

 

We are looking to limit the email field to receive only one domain  (ex. sebastian@onlythisdomain.com)

Based on this article we try to change the email to onlythisdomain but it didn’t work

<script> window.ub.form.customValidators.nonWebmailEmail = { isValid: function(value) { return /\@(?!(onlythisdomain)\.)/.test(value.toLowerCase()); }, message: 'Please enter your work email address', }; </script> <script> window.module.lp.form.data.validationRules['my_email_form_field_id_goes_here'].nonWebmailEmail = true; </script>

 

any suggestion? 


5 replies

Userlevel 2
Badge

Hey @sebastiano! Thanks for your question.

The previous article in which you referenced was specifically for excluding the domains found in the script (e.g. gmail, hotmail, etc) to ensure that the email in the form submission comes from a non-generic/personal email. Unless I’m misreading the script you provided above, it looks as though the script is going to now reject the domain in which you are inserting. Therefore, I would revert back to the original script in the interim while we try and find a script for you specific to the one domain you’re looking to accept.

Can you explain the use case in which you’d only like to accept form submissions from one domain name?

 

 

 

Badge

Hi phildilello ,

Thank you so much for your answer and help.

The case scenario for this is for example a form that have a email from a referral, and we know that is only one company that we are working with, so the person referred to our landing page need to fulfill this with the email of the sales rep from the company. 

 

This is the reason we want to allow only one domain, or well maybe not one domain but restrict to specific domains.

Userlevel 4
Badge +1

Hey @sebastiano! I’m tagging a couple of our long time community members, in the hopes that they might have some insights/tips to share. @Nicholas @julien_level @Finge - any thoughts on this one?

Badge

Hey @sebastiano! I’m tagging a couple of our long time community members, in the hopes that they might have some insights/tips to share. @Nicholas @julien_level @Finge - any thoughts on this one?

Thank you so much Amanda :D

Userlevel 5
Badge +4

HI there,


I use Jotform now on my LP so i would use their conditional logic.

But maybe you could try Zapier, if you use it, to block email where you don’t find a specific value in the field (like the domain.com you want).

 

Reply