AnsweredAssumed Answered

Issues with Custom Validation on Embedded Form

Question asked by 160eb60b5c0de30035954462cb70ba741ccb9dbe on Apr 25, 2014
Latest reply on Jul 31, 2014 by 44939
Hello All,

I'm using the Forms 2.0 builder for the first time and I'm running into some issues that I can't seem to resolve.

I need to enable custom validation on 2 different fields in my form, a 'password' field and a 'confirm password' field. I've gotten this working for the most part, but have run into 2 issues that I can't figure out.

  1.           If the form is submitted and there is a validation error, my custom message is showing up as desired. But if I then fixed the error and submit the form again, the form does not submit correctly. The page seems to reload, but nothing happens (no JavaScript error either).
  2.           If the form is submitted with errors on both custom fields, an error message shows up on the first of the two. If I fix the first error and submit again, no error message shows up on the 2nd custom field. Instead again, the page seems to reload and does not submit.
I was using the sample code available on this link - - has anyone run into a similar issue as this?  

Below is my current JavaScript for the form embed:

     <script src="//"></script>
     <form id="mktoForm_1373"></form>
     //var theForm = document.getElementById("mktoForm_1373");
     MktoForms2.loadForm("//", "729-ZYH-434", 1373, function(form){
     var vals = form.getValues();
     if (vals.platformPassword.length < 8) {
         var platformPassword = form.getFormElem().find("#platformPassword");
         form.showErrorMessage("Your password must be a minimum of 8 characters in length.", platformPassword);
     } else if (vals.platformPasswordConfirm != vals.platformPassword) {
         var platformPasswordConfirm = form.getFormElem().find("#platformPasswordConfirm");
         form.showErrorMessage("Your password confirmation does not match your password.", platformPasswordConfirm);
     } else {

I'm not getting a JavaScript error - it just doesn't work.