Informatica Email Hygiene Webhook
We have successfully implemented the Informatica/Marketo connector by creating a webhook that has response attributes mapped to custom Marketo fields for form submission on our websites. We would like to display helpful error handling messages on the front end of our Marketo 2.0 forms when certain email hygiene conditions are met.
For example, if a user types in an invalid email address and we are returning an Informatica email reason code of: 301. The Informatica response of email reason code 301 indicates that the email submission was missing the @ symbol. It would be helpful if we could then display "please ensure you have the '@' symbol" on the front end of our form before submission.
Is this possible through the Marketo Javascript API? We have tried a few methods with onValidate and onSubmit as seen below with no luck thus far.
MktoForms2.loadForm("//app-ab07.marketo.com", "920-LJZ-738", 2151, function (form){
form.onValidate(function(){
//get the values
var vals = form.vals();
//Check your condition
if(vals.emailReasonCode == "301"){
//prevent form submission
form.submittable(false);
//Show error message, pointed at Email element
var EmailElem = form.getFormElem().find("#Email");
form.showErrorMessage("please ensure you have the '@' symbol", EmailElem);
}else{
//enable submission for those who met the criteria.
form.submittable(true);
}
});
});
</script>