Jquery validate does not validate correctly

Asked

Viewed 1,420 times

3

I am using Jquery validate and unobtrusive for validation in an Asp.net mvc 5 project

When I needed to work with decimal numbers, in search I found this Link where it has the validations and etc.

But I have the following problem:

If I leave my Bundle like this:

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

It works correctly on my Decimal fields, but it stops removing the Validationmessagefor msg by filling in the other fields correctly from the other validations(required for example)

And if I leave like this:

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

It works my validations but does not work the validation of decimals

1 answer

1


Use like this:

bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                    "~/Scripts/jquery.validate.js",
                    "~/Scripts/jquery.validate.unobtrusive.js",                        
                    "~/Scripts/jquery.validate.globalize.js"));

The decimal problem has nothing to do with jQuery Validate, but Globalize is missing:

https://www.nuget.org/packages/jQuery.Validation.Globalize/

  • It worked, but it’s like I explained, it doesn’t "remove" the Validationmessagefor msg when filling in the fields correctly

  • This is the normal behavior of jquery.validate. I will search in the documentation if you have a way to hide the messages from the correct fields, then update in the reply.

  • It must be unobstrusive then, for it is as I explained, if it gets reversed it does what I have commented

Browser other questions tagged

You are not signed in. Login or sign up in order to post.