[英]Remove unobtrusive validation from MVC 4 template
I created a new project using the ASP.net MVC 4 Web Application template in Visual Studio 2012 (Forms Authentication) and I want to remove unobtrusive validation from it. 我在Visual Studio 2012(表单身份验证)中使用ASP.net MVC 4 Web应用程序模板创建了一个新项目,我想从中删除不干扰用户的验证。 I made the following changes: 我进行了以下更改:
add key="UnobtrusiveJavaScriptEnabled" value="false"
更改了web.config- add key="UnobtrusiveJavaScriptEnabled" value="false"
BundleConfig
to remove the jquery.validate.unobtrusive.js
script 更改了BundleConfig
以删除jquery.validate.unobtrusive.js
脚本 _Layout
so that the jquery/jqueryval bundles were in the <head>
section. 我更改了_Layout
,以使jquery / jqueryval束位于<head>
部分中。 These are the only changes I made, but I am not getting any client side validation. 这些是我所做的唯一更改,但是我没有得到任何客户端验证。 When inspecting the scripts in chrome, I see jquery and jquery.validate
(not unobtrusive) and it is not putting the unobtrusive attributes in my markup, but client side is not working at all. 当检查chrome中的脚本时,我看到了jquery和jquery.validate
(不是不引人注目),它没有在我的标记中jquery.validate
不引人注意的属性,但是客户端根本不起作用。
What else do I need to do/undo to get rid of unobtrusive validation? 我还需要做/撤消什么才能摆脱不打扰的验证?
Edit 编辑
Inspecting the markup this is also in my page: 检查标记,这也在我的页面中:
<script type="text/javascript">
//<![CDATA[
if (!window.mvcClientValidationMetadata) { window.mvcClientValidationMetadata = []; }
window.mvcClientValidationMetadata.push({"Fields":[],"FormId":"form0","ReplaceValidationSummary":true,"ValidationSummaryId":"validationSummary"});
//]]>
</script>
remove tags like 删除类似的标签
@Html.ValidationSummary(true)
@Html.ValidationMessageFor(model => model.roleId)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.