gpt4 book ai didi

c# - MVC 2 中使用 JQuery 的验证摘要

转载 作者:太空宇宙 更新时间:2023-11-03 14:30:17 24 4
gpt4 key购买 nike

我正在尝试让客户端验证在我的 asp.net mvc 2 web 应用程序 (Visual Studio 2010) 上运行。客户端验证正在 工作。但是验证摘要不是。

我包括以下脚本

<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>

在这个表单开始之前有这个

<% Html.EnableClientValidation(); %>

在表格里面是

<%: 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>

我从 MvcFutures 下载了最新版本的 MicrosoftMvcJQueryValidation.js,但它看起来不支持验证摘要。我已尝试通过设置额外的选项(例如 errorContainer 和 errorLabelContainer)来纠正此问题,但看起来它还有一些更根本的问题。

这个文件有更新/更好的版本吗?

最佳答案

到目前为止,我找到的最佳解决方案是 Since Ince 的补丁,可以在 jQuery.validate, and Html.ValidationSummary playing nice together 找到.

关于c# - MVC 2 中使用 JQuery 的验证摘要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2816072/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com