简体   繁体   中英

Validation Summary with JQuery in MVC 2

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?

到目前为止,我找到的最好的解决方案是自Ince以来的一个补丁,可以在jQuery.validate和Html.ValidationSummary一起很好地玩

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM