Validation Summary with JQuery in MVC 2
Posted
by Nigel Sampson
on Stack Overflow
See other posts from Stack Overflow
or by Nigel Sampson
Published on 2010-05-12T04:09:21Z
Indexed on
2010/05/12
4:14 UTC
Read the original article
Hit count: 681
I'm trying to get client validation working on my asp.net mvc 2 web application (Visual Studio 2010). The client side validation IS working. However the validation summary is not.
I'm including the following scripts
<script type="text/javascript" src="../../content/scripts/jquery-1.4.1.js"></script>
<script type="text/javascript" src="../../content/scripts/jquery.validate.js"></script>
<script type="text/javascript" src="../../content/scripts/MicrosoftMvcJQueryValidation.js"></script>
Have this before this form is started
<% Html.EnableClientValidation(); %>
and inside the form is
<%: Html.ValidationSummary("There are some errors to fix.", new { @class = "warning_box" })%>
<p>
<%: Html.LabelFor(m => m.Name) %><br />
<%: Html.TextBoxFor(m => m.Name) %>
<%: Html.ValidationMessageFor(m => m.Name, "*") %>
</p>
I have that latest version of MicrosoftMvcJQueryValidation.js from the MvcFutures download, but it doesn't look like it supports Validation Summary. I've tried correcting this by setting extra options such as errorContainer and errorLabelContainer, but it looks like there's some more underlying issues with it.
Is there an updated / better version of this file around?
© Stack Overflow or respective owner