Jquery validation does not work asp.net mvc5?

0

I'm creating a project in ASP.NET MVC5 using C# and the FrontEnd validations are not working, even after I reference the

bundle @Scripts.Render("~/bundles/jqueryval") na view. 

If I inspect HTML, I can see that the scripts have been correctly referenced:

<script src="/Scripts/jquery.validate.js"></script>
<script src="/Scripts/jquery.validate.unobtrusive.js"></script>

I also leave here a part of my Web.config , which is used to activate the validations FrontEnd :

<add key="ClientValidationEnabled" value="true" />

I also want to leave here a part of bundle.conf :

bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
         "~/Scripts/jquery.validate*"));

In the view it looks something like this:

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}

I have tried everything, from clearing the project to manually reference scripts . But nothing seems to work. I tried until I created a new project, just to test, to make sure I was doing okay. I created a class, I added the ( DataAnotations ), I also created a View and referenced JQuery-val and it worked perfectly.

There is no error in the browser either.

I have no ideas to try to solve the situation, has anyone ever had a similar problem?

I've already figured out the solution. Just go to web.conf and add the following line inside app settings

<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
    
asked by anonymous 26.05.2018 / 16:18

0 answers