Forms 2.0 onSubmit Validation Script

Anonymous
Not applicable
When I use the onSubmit validation code from #9 on the Forms 2.0 page  the validation works. However when I change the value in the field that I am trying to validate the form doesn't run through the onSubmit again and the form is unsubmitable. 

View code below:




MktoForms2.loadForm("//app-abk.marketo.com", "###-###-###", 89,function(form){
 
form.onSubmit(function(){
  
   var vals = form.getValues();
   
   if( vals.verify != "Verify" || vals.verify != "verify" ) {
    form.submitable(false);
var verify = form.getFormElem().find("#verify");
form.showErrorMessage("You must type the word 'Verify'", verify);
} else {
form.submitable(true);
}
 
   });
 
form.onSuccess(function(values, followUpUrl){
   form.getFormElem().fadeOut();
   return false;
 });
 
 
});

Tags (1)
14 REPLIES 14