简体   繁体   中英

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. I made the following changes:

  1. Changed web.config - add key="UnobtrusiveJavaScriptEnabled" value="false"
  2. Changed the BundleConfig to remove the jquery.validate.unobtrusive.js script
  3. I changed _Layout so that the jquery/jqueryval bundles were in the <head> section.

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.

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)

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