I have an accordion JQuery UI control that shows two different sets of fields. At least one set has to be enabled, and when it is, it needs the validation disabled for the other set. This has been really frustrating to implement dynamically.
Finally I settled on maybe just removing the validation rules right before the submit on the set of fields that are collapsed. (So the user is no required to fill that set). However, even then I can't seem to figure out how to attach an event to the form's submit event that will run before the validation! I was this function to run before the JQuery validation. I'm using MVC3. Here's what some of my code looks like:
<div id="accordion">
<h3><a href="#">Option Set 1</a></h3>
<div>
[Set of fields here]
</div>
<h3><a href="#">OR Option Set 2</a></h3>
<div>
[Set of fields here]
</div>
</div>