HOWTO ASP.NET MVC 2.0 Client-Side Validation

Where can I find good information about the new client-side validation features included in ASP.NET MVC v2?

I would like to find information on using JavaScript for client-side validation without using DataAnnotations, and I would like to know how user validations are handled.

For example, if I want to check two fields together, how can I use the provided JavaScript? Or if I wanted to write a verification code on the server side that requested the database, how could I use the provided JavaScript to implement a similar verification?

I don't see books on MVC2 yet, and the blog entries I found are not detailed enough.

+4
source share
2 answers

DataAnnotations have limitations. You can easily apply simple rules for validating independent model properties and enable client-side validation , but if you need to handle more complex scenarios, such as dependent properties, you will need a more robust framework such as Fluent Validation or xVal .

+2
source

Here is a 20-minute video demonstration.

10-4 Episode 37: Using Model Metadata and Validation Using ASP.NET MVC2

Posted by: Jonathan Carter | January 7 @ 11:21 am

In this episode 10-4, we discuss a new feature that will appear in the next release of ASP.NET MVC: Model Metadata and Validation. This allows you to associate validation rules and metadata with your model and perform a validation check automatically. In addition, you can also have JavaScript that will provide client-side validation as well, which makes it dead just to achieve validation of a reliable client and server experience with any web application.

+1
source

Source: https://habr.com/ru/post/1306971/


All Articles