xVal Validation Framework - Connecting Client-Side Validation to Server-Side Validation
Wednesday, April 08, 2009
Steve Sanderson created the xVal Validation Framework to help you implement client-side validation with your server-side validation framework of choice in the ASP.NET MVC Framework.
Per the xVal project description:
"xVal is a validation framework for ASP.NET MVC applications. It makes it easy to link up your choice of server-side validation mechanism with your choice of client-side validation library, neatly fitting both into ASP.NET MVC architecture and conventions."
- Designed to fit into ASP.NET MVC conventions for handling form posts and storing and retrieving error information in ModelState
- Use your choice of server-side validation framework. Out of the box, xVal lets you use .NET 3.5's built-in DataAnnotations classes or Castle Validator (or both). If you want to use something different, you can create your own provider just by implementing IRulesProvider
- Use your choice of client-side validation library. Out of the box, xVal lets you use jQuery Validation or ASP.NET's native client-side validation library (a.k.a. WebUIValidation.js, as used by WebForms). Or, use any other client-side validation library by writing a plug-in to configure it using xVal's standard JSON rules description format.
- Supports localized error messages using resource files. Vary the language of your validation messages according to the current thread's culture.
- Add custom validation logic that runs both on the server and on the client, either by subclassing an existing rule or by referencing a custom JavaScript function.

Check out the xVal Validation Framework on CodePlex.
Tags: ASP.NET MVC Validation , xVal