How to combine mvc2 client side validation with other client side validation?

Posted by Andrey on Stack Overflow See other posts from Stack Overflow or by Andrey
Published on 2010-04-20T00:45:27Z Indexed on 2010/04/20 0:53 UTC
Read the original article Hit count: 425

Filed under:
|
|
|

I have a page using mvc2 with client side validation. The client side validation is provided by Microsoft Ajax mvc validation script. This does very well to validate all fields that are related to the model.
I also have fields that are never sent to the server such as the confirm password value, and the accept agreement. For these fields i need pure client side validation. I created the javascript to do this, but am now having a hard time integrating the two validatiosn together. I was hoping that i could do something like add another error to an array, or set the page manually to not valid to make sure that the user cannot submit. Basically follow the same approach that i would with normal asp.net validation. I can't find anything like that. In all examples validators are discussed that are connected to parts of the model. What is my best approach here?

© Stack Overflow or respective owner

Related posts about mvc2

Related posts about JavaScript