Implementing Remote Client-Side Validation

Jun 21, 2009 at 12:46 PM

Hi,

It took me a while, but I figured out way to generically implement remote client-side validation with xVal / jQuery.validate so that

  •  Validation rules remain solely in your ASP.NET MVC model
  •  You write each validation rule just once, and only in easily testable C# code. There is no JavaScript or other client-side counterpart .
  • There is no need to branch or otherwise modify xVal or jquery.validate
  • All you have to do for each new remote form validation rule is to derive from the base class shown in this article.

I figured this might also be of interest to other xVal users, so I wrote a blog article on this at

http://devermind.com/aspnet-mvc/asp-net-mvc-tip-3-how-to-cover-all-your-client-side-form-validation-needs-without-writing-any-javascript-part1

I'd be interested in any feedback you might have on this.