jQuery Validate - invalidHandler question

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:

  1. $(#formname).validate({
  2.       invalidHandler : function() {
  3.             if ($('.client_validation').length)
  4.                   $('.billingAddress').addClass('showForm');
  5.             }
  6.       }
  7. });
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