does anyone know if there is a way to trigger the client side form validation in a .Net MVC app manually? I want to do the following:
<script type="text/javascript">
if([form valid]) {
//do something
}
</script>
I already looked through the code in MicrosoftMvcValidation.js but didn’t find a method I could call on the form.
I think the validation you are looking for can be found here:
http://www.phpvs.net/2010/04/26/manually-validate-an-asp-net-mvc-form-on-the-client-side-with-microsoftmvcvalidation-js-and-jquery/
The deal is you need context of Sys.Mvc.FormContext, which has a .validate on it. This is what needs to be called. Just check out the blog post and you will be happy. 🙂