I have two forms that are almost exact that I’m validating with jquery validate plugin. One form works https://www.anticipateinvitations.com/index.php/contact while the other https://www.anticipateinvitations.com/index.php/how doesn’t work. Both forms are using the same validate method
$('.contact-form').each(function() { // attach to all form elements on page
$(this).validate({ // initialize plugin on each form
// global options for plugin
rules: {
fname: "required",
ptime: "required",
email: {
required: true,
email: true
},
captcha: {
required: true,
captcha: true
}
},
messages: {
fname: "Please enter your name",
ptime: "Select a preferred time",
email: {
required: "Please provide an email address",
email: "Please enter a valid email address"
},
captcha: {
required: "Give an answer to the sum"
}
}
});
});
Initially I was getting invalid input error on the form that doesn’t work until I added <input type="hidden" name="XID" value="{XID_HASH}">
after searching around for a solution. Now the form just reloads the page after submission and the validation plugin does not fire.
The forms have different IDs so that I can handle submission differently. All custom JS is in one file. I had tried separating the validate using the IDs which didn't work. Jquery is present on page since on firebug I can play around with the DOM elements but it feels like there is no javascript on the second form since even the calendar on that page does not working which works on the form that is ok, Im running EE 2.7.2 secure forms submission is on.
Any help please?