How do I get a form to display an error message in real time Hey guys,
So big thanks to the people that put the JS out that to block "free" email addresses from form submissions. My question is, how do I get it so that the alert that pops up displays once a user moves on to the next field. Right now it will display when they hit the submit button.
Anyone know what needs to be done?
For reference, here's the JS I'm using:
(function (){
// Please include the email domains you would like to block in this list
var invalidDomains = ["@gmail.","@yahoo.","@hotmail.","@live.","@aol.","@outlook."];
MktoForms2.whenReady(function (form){
form.onValidate(function(){
var email = form.vals().Email;
if(email){
if(!isEmailGood(email)) {
form.submitable(false);
var emailElem = form.getFormElem().find("#Email");
form.showErrorMessage("Must be Business email.", emailElem);
}else{
form.submitable(true);
}
}
});
}); function isEmailGood(email) {
for(var i=0; i < invalidDomains.length; i++) {
var domain = invalidDomains[i];
if