One thing to remember is that if you ever go with a social login you don't want to force work-only emails. I don't know about you, but I use my personal email for LinkedIn.
That's a good point Robb. I'll have to keep that in mind, though I don't imagine the script impacting that flow as if leads are using social login, they should be created in our database via the API.
We use a custom javacript as hidden HTML in the form itself. It's actually quite easy. Here's what we throw in:
Note: Remember to change the highlighted text with form-specific information. You can put whatever "public" email domains you wish directly into the list of invalid domains.
<script type="text/javascript" src="http://info.ascentis.com/js/public/jquery-latest.min.js" language="Javascript"></script>
<script src="//app-abj.marketo.com/js/forms2/js/forms2.js"></script>
<form id="mktoForm_355"></form>
<script>
// set no conflict mode for jquery
var $jQ = jQuery.noConflict();
//edit this list with the domains you want to block
var invalidDomains = ["@gmail.com","@yahoo.com","@live.com","@hotmail.com","@aol.com","@comcast.net","@earthlink.net","@msn.com","@sbcglobal.net","@bellsouth.net","@bellsouth.com","verizon.net","@me.com","@icloud.com"];
function isEmailGood() {
for(i=0; i < invalidDomains.length; i++) {
if ( $jQ("#Email[value*=" + invalidDomains[i] + "]").length > 0) {
return false;
}
}
return true;
}
MktoForms2.loadForm("//app-abj.marketo.com", "your marketo user ID", 355, function(form){
if(!isEmailGood()) {
// just in case this doesn't work, change "form.showErrorMessage" to "alert" form.showErrorMessage("Business email domain required"); form.submitable(false); } else { form.submitable(true); }});
form.submitable(true);
});
});
</script>
The authoritative list of free (frequently interpreted as "non-business," though there are plenty of examples to the contrary) domains is the Freemail list. Also, that isn't really the right way to use the Forms 2.0 API. But we digress...