Client validate in MVC 2

Posted by khoailang on Stack Overflow See other posts from Stack Overflow or by khoailang
Published on 2011-01-13T04:48:15Z Indexed on 2011/01/13 4:53 UTC
Read the original article Hit count: 209

Filed under:
|
|

Hello, I'm very new in MVC 2,

Let say, I have a page with 1 text box and 2 input typed submit, "back" and "next".

I'm using client validation like this:

"" type="text/javascript"/>" " type="text/javascript"/> " type="text/javascript"/> . . . <% Html.EnableClientValidation(); %> . . . . . . and validation rule used for that text box is [StringLength(100, ErrorMessage="This field should be no longer than 100")]

My wish is that validation rules will be applied only when I click on Next button. And when I click on Back button, no validation error message will be displayed and form will be posted to server. Is it possible to do that? could you please tell me how?

My problem now is that when I click Back, validation rules are applied and prevent me from posting back to server.

© Stack Overflow or respective owner

Related posts about mvc

Related posts about validation