I just tested it and it works. the script just control the correctness of the address. But you should probably use Sanford's or Courtney's version, they are both outstanding developers.
-Greg
Oh if it checks for the format then marketo can do that as well. How can I
stop spam submissions in Marketo so no junk email enters into my database
On 11-May-2017 5:31 pm, "Grégoire Michel" <marketingnation@marketo.com>
Are you trying to stop non-emailable (as opposed to suspiciously/improperly formatted) addresses from being submitted? If so, you'll need to use extended validation. Etumos Verify integrates natively with Marketo Forms and is naturally* my recommendation.
*I contributed the forms integration for Verify.
Use a Google Recaptcha to avoid robots. Use Courtney's script to avoid non professional emails. Or look into launchpoint solutions for more sophisticated solutions. AFAIK, Etumos is offering such a solution (Etumos Verify - Etumos ). Contact Edward Unthank or Sanford Whiteman for it.
-Greg
Sorry my JS knowledge isn't great. Grégoire will this work on embedded forms on non-marketo landing page?
Also do I need to change anything in your code in order for it to work on my form? Or can I just copy and paste it before the closing body tag?
Hi Phillip,
I suppose it depends on whether it's human error or bots performing this behavior, but I've been using mailcheck.js to handle instances like this when it's human error and then just doing the following for Marketo:
$(document).ready(function(){
MktoForms2.whenReady(function (form){
var domains = ["yahoo.com", "google.com", "hotmail.com", "gmail.com", "me.com", "aol.com", "mac.com",
"live.com", "comcast.net", "googlemail.com", "msn.com", "hotmail.co.uk", "yahoo.co.uk",
"facebook.com", "verizon.net", "sbcglobal.net", "att.net", "gmx.com", "mail.com", "outlook.com"];
var topLevelDomains = ["co.uk", "com", "net", "org", "info", "edu", "gov", "mil"];
// var superStringDistance = function(string1, string2) {
// string distance algorithm of your choosing
// }
var selector = '#Email, .mktoEmailField, .mktFormEmail, input[type=email]';
$(selector).on('blur', function(){
$(this).mailcheck({
domains: domains,
topLevelDomains: topLevelDomains,
//distanceFunction: superStringDistance,
suggested: function(element, suggestion) {
var $parent = $(selector).parent();
$('.mailcheck-msg', $parent).remove();
$parent.append('<span class="mailcheck-msg">Did you mean <a href="#" class="mailcheck-suggestion">' + suggestion.full + '</a>?</span>');
},
empty: function(element) {
var $parent = $(selector).parent();
$('.mailcheck-msg', $parent).remove();
if ( !$(selector).val().match(/^[\w\d\.\-\_']+@([\w\d\-]+\.)+\w{2,}$/) )
$parent.append('<span class="mailcheck-msg mailcheck-error">Please enter a valid email address.</span>');
}
});
$('a.mailcheck-suggestion').on('click', function(){
$(selector).val( $(this).html() );
$(this).parent().remove();
return false;
});
});
});
});
Obviously feel free to tweak the deployment code as needed for your purposes.