Require business email address


#1

Hello i am new to this forum, apologize if this question has already been asked, i didn’t see it scrolling through the forum. Does anyone have a workaround or some code to require a business email address on the unbounce page? Most of our other forms don’t allow hotmail,gmail, etc.


#2

Hi there!

I haven’t given this script a try, but it should work.

Let me know if you run into any issues :slight_smile:


#3

Thanks, really appreciate your help! I’ll let you know how it goes.


#4

A fix for anyone running into the issue where this doesn’t load any longer:
It’s using a jQuery version from 1846, so it’s taking ages to execute compared to everything else.
Adding a 500ms setTimeout fixed the issued.


#5

This is extremely useful, thanks!


#6

Thank you, this fixed my issue as well!

Posting code here for other users:

<script>

  /**
    * Do not remove this section; it allows our team to troubleshoot and track feature adoption.
    * TS:0002-07-017
  */
setTimeout(function(){
  lp.jQuery(function($) {

    // Replace email_address with the actual ID of your form field.
    var field = 'email_address';

    // Optionally change this to customize the validation error that your visitors will see if they enter a webmail address.
    var message = 'Please enter your work mail address.';

    var rules = module.lp.form.data.validationRules[field];
    $.validator.addMethod('notWebmail', function(value, field) {
      var valid = /\@(?!(me|mac|icloud|gmail|googlemail|hotmail|live|msn|outlook|yahoo|ymail|aol)\.)/.test(value.toLowerCase());
      return valid || (!rules.required && !value);
    }, message);
    rules.notWebmail = true;

  });
}, 500);</script>

#7

Hi there! I added the code to the Javascript section of my landing page but it doesn’t seem to be working. As someone who doesn’t code - is there any spacing issues I need to change or should I be able to copy and paste as it is? Thank you! I also attached a screenshot.