Email validation to catch typos

  • 31 December 2015
  • 9 replies
  • 219 views

Badge

Many people who enter an email address on my forms are including obvious typos in the domain of their email. For example, john@gamil.com, jane@yaho.com, frank@hotmail.con, etc. Because they follow the correct syntax for emails, they are not caught by the default validation for email addresses.

Is there a way for us to catch these? For example, can we use some code to create a list of popular misspellings of domains, and reject them?


9 replies

Interested!

Userlevel 7
Badge +3

Hi guys, 

Depending on how comfortable you are with writing scripts, you should be able to accomplish your desired goal with a bit of javascript/jquery. 

Here are a few links for inspiration: 

  1. Here is a way to exclude free email providers, which in theory you can modify to reject misspelled domains.

  2. A more elegant solution, which requires a bit more tinkering with javascript. 

Hope this points you in the right direction. 

Best,
Hristian

Hi Andy,

I use Data 8 domain validation for a client on an Unbounce landing page. Please check the link below.

https://www.data-8.co.uk/services/data-validation/validation-services/email-validation

This works well to ensure we get good quality data from our form submissions. 

Hope that helps a little,

Cheers

Stuart.

Userlevel 7
Badge +3

Hey Stuart, 

Awesome tip as data validation is always better with a service that actually checks if the domain exists, etc.

Definitely worth it if the budget/requirements allow for it.

Best,
Hristian 

Badge

Thank you very much! We’ll try these out, and let you know how it goes.

Hi Stuart,

Can you post a sample code of you how managed to get Data-8 Validation working with Unbounce.

I almost got it working thanks to the sample code posted here (http://www.howtobuildsoftware.com/index.php/how-do/Y1s/“) but still can’t get Unbounce to react properly on the response I get from Data-8 service.

Regards,
Nikolay

Using the Unbounce Custom Validation Script from this page and script posted on Stackoverflow regarding Data-8 Validation I almost got it working but my problem is that the Unbounce Custom Validation script does not wait for the response of the IsValid function once it is being called but always returns “undefined”. How can I make it wait for the response (true or false) of the function.

The exact code that I use to setup the Data-8 Function is:



<script type="text/javascript">
 
function loadIntegr8() {
  // Load the InternationalTelephoneValidation Integr8 service
  data8.load('InternationalTelephoneValidation');
}
 
var funReady;

function IsValid(telephoneNumber, defaultCountry) {
  funReady = new $.Deferred();
  var internationaltelephonevalidation = new data8.internationaltelephonevalidation();
  internationaltelephonevalidation.isvalid(
    telephoneNumber,
    defaultCountry,
    [
      new data8.option('UseMobileValidation', 'true'),
      new data8.option('UseLineValidation', 'true')
    ],
    showIsValidResult
  );


           $.when(funReady).then(function() {
         console.log (funReady.state());
    return funReady.state() === "resolved" ? true : false;

       });


 

}


function showIsValidResult(result) {
  if (!result.Status.Success) { // http(s) request failed
    funReady.reject();
  }

  if(result.Result.ValidationResult == "Invalid") {
    funReady.reject();
  } else {
    funReady.resolve();
  }
}

loadIntegr8();
  
  
 
</script>

And the code used for the Unbounce Custom Validation is:

<script type="text/javascript">
  
  lp.jQuery(function($) {
  
    // Config
    var ruleID = 'myCustomRule';
    var field = 'phone_number';
    var message = 'Invalid UK Phone Number';
  
    var rules = module.lp.form.data.validationRules[field];
  
    $.validator.addMethod(ruleID, function(value, field) {
  
      // Replace this with any expression you like. It should evaluate to true
      // if the field is valid and false if invalid. This example adds a 
      // rule that the user must enter 'I accept' exactly into the field.
            var valid = IsValid(value, 'GB');
    
   


     

      return valid || (!rules.required && !value); 
      
    }, message);
  
    rules[ruleID] = false;
  
  });
</script>
Badge

I just implemented a new and much easier way to do this using Neverbounce. I added the script at the page level, it did not work properly for me on every page at the domain level. The email field has to have the word “email” in the field name, or so it seems.
Instructions: https://neverbounce.com/integrations/unbounce

I chose to use the free Verifalia email verification widget, which only requires copying and pasting a single line of JavaScript code: https://verifalia.com/email-verification-widget 

Here is the step by step guide: https://verifalia.com/help/email-verification-widget/how-to-block-invalid-emails-in-unbounce-landing-pages

Reply