jQuery Validate - invalidHandler question
I'm running validation on a form that has two components, a payments segment and an address segment. Both of these need to be within the same form. By default, the address segment is hidden. Upon validation, I would like to display the payment segment, but only if there are validation errors within that segment.
Using invalidHandler, I've been able to successfully fire a function when errors are returned, but I haven't found a way to check if there are errors within that container. My plan was to check for the invalid class within that container... something like this:
- $(#formname).validate({
- invalidHandler : function() {
- if ($('.client_validation').length)
- $('.billingAddress').addClass('showForm');
- }
- }
- });
The problem is that the invalid class (.client_validation) isn't applied when the invalidHandler function is executed. Any thoughts on how to do this?
Thanks