Multipart form using Validate + Accordion problem
Hi All,
I need some pointers on what I'm doing wrong here. I followed the
multipart form demo included with jquery.validate, creating a custom validation rule like so:
-
$.validator.addMethod("pageRequired", function(value, element) {
var $element = $(element)
function match(index) {
return current == index && $(element).parents("#fields" + (index +
1)).length;
}
if (match(0) || match(1) || match(2) || match(3)) {
return !this.optional(element);
}
return "dependency-mismatch";
}, $.validator.messages.required)
I wrap a #fieldsN div around the elements I am validating on a
specific page, like the multipart example does. Everything appears to work, except one problem: after I validate the current page and move onto the next one, the errors on the next page appear immediately as though it was validated when it shouldn't be. I have tried to hide the errors without success. What am I doing wrong here?
Here's the page:
http://iceant.com/qls/qls/accordion
Here's the javascript I'm using:
http://iceant.com/qls/js/custom/accordion.js
Here's what I used as a reference:
http://jquery.bassistance.de/validate/demo/multipart/
Any help would be greatly appreciated.