Asp.Net JQuery Unobtrusive Conditional Validation

I ran into an issue where I was doing Asp.Net Mvc validation on one of my forms. I wanted it so that three things were required only if a checkbox was checked. I know that out of the box this isn’t supported so I googled around until I found this article:

http://blogs.msdn.com/b/simonince/archive/2011/02/04/conditional-validation-in-asp-net-mvc-3.aspx

The article goes over conditional validation with a custom validator and some extension code so that it works client side. Good stuff. Thanks Simon Ince.

It worked like a champ. Note: THIS IS NOT MY CODE. I am putting it in here so that people don’t have to download the solution file from his website to analyze and re-produce the solution.

Here is the Javascript: