Validation of fields in cshtml

Asked

Viewed 122 times

1

I have seen some examples to validate fields, but all of them I have to inform which field or control to be validated, IE, I have to pass Name of the controls. In case I have a form with 20 fields, it is that "linguição". How do I stop at once, validate the various types of controls I have in my form, such as Inputs, Options and etc? Can be via javascript, jquery and etc....

Use MVC 5 and this validation is in my CSHTML.

  • 2

    What are the validations? How is it being done today? Edit your question and enter this information.

1 answer

1

These fields can be validated by data annotations as in this example I did in my blog, or using jQuery validation as in this example (jQuery validation attributes that will be passed to the method must have the same name of the HTML element).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.