Anyone?
On Oct 20, 12:32 pm, ovalsquare <[EMAIL PROTECTED]> wrote: > I am attempting to paginate a form, and validate for each page (page > navigation via accordion or simply .show()/.hide()). However, the only > sample I've seen of this appears to be the Help me Buy and Sell a > House demo athttp://jquery.bassistance.de/validate/demo/multipart/. > This sample requires that a "pageRequired" method be added as follows: > > $.validator.addMethod("pageRequired", function(value, element) { > var $element = $(element) > function match(index) { > return current == index && $(element).parents("#sf" + > (index + > 1)).length; > } > if (match(0) || match(1) || match(2)) { > return !this.optional(element); > } > return "dependency-mismatch"; > }, $.validator.messages.required) > > var v = $("#cmaForm").validate({ > errorClass: "warning", > onkeyup: false, > onblur: false, > submitHandler: function() { > alert("Submitted, thanks!"); > } > }); > > I would much prefer to take my existing setup with customvalidation > messages for each field, as well as the ability to use per field > specificvalidation(i.e. email, maxLength, custom addMethods, etc.), > as in the following: > > //Validation > var container = $("#myForm div.validationSuggestion"); > > $('#myForm').validate({ > errorContainer: container, > errorLabelContainer: $("ul",container), > rules: { > someField: { required: true }, > someOtherField: {required: true, maxLength:20 } > //many other fields. > }, > messages: { > someField: 'Error message for someField.', > someOtherField: 'Another specific error message.' > // many other fields. > }, > highlight: function(element, errorClass) { > $(element).addClass(errorClass); > $(element.form).find("label[for=" + element.id + > "]").addClass(errorClass); > $(element.form).find("label[for=" + element.id + > "]").removeClass("valid"); > }, > unhighlight: function(element, errorClass) { > $(element).removeClass(errorClass); > $(element.form).find("label[for=" + element.id + > "]").removeClass(errorClass); > $(element.form).find("label[for=" + element.id + > "]").addClass("valid"); > }, > wrapper: 'li' > }); > > I cannot have multiple forms (I only want to submit on the last page). > Am I missing something obvious?