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.
Require business email address
Hi there!
I haven’t given this script a try, but it should work.
Let me know if you run into any issues
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.
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>
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.
@MoniqueSherman @Stefano I am having the same issue. Did this ever get resolved?
I’m:
-using the same script
-implementing the javascript in the head section
-enabling both jQuery 1.3.4 and 1.4.2
-making sure the “var field” matches the form ID
-testing with a gmail.com address
Not sure where this is going wrong…