Hi,
We have a few active Landing pages as part of our digital campaigns. While we have specified “business email ID” in our forms, we have been getting a lot of personal email addresses and wanted a way to ensure that only business email addresses are entered on our landing page form. From the community discussions, I have used the following code but it is not helping us accept only non-personal email IDs as input. Could you someone let us know what the error is and how can we fix it? Not sure if this is relevant, we do have a GTM container active for accurate tracking. I am not really sure if that is interfering with the JS that we are trying to run. Here is the code below. Please help! Cheers!
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.validationRulesifield];
$.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);