Jquery validation plugin – TypeError: $(…).validate is not a function

You’re not loading the validation plugin. You need: <script src=”http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js”></script> Put this before the line that loads the additional methods. Also, you should get the additional methods from the CDN as well, rather than jquery.bassistance.de. Other errors: [4.20] should be [4,20] and rangelenght: should be: rangelength:

Error in jquery.validate.js in MVC 4 Project with jQuery 1.9

This issue is fixed in jQuery Validation Plugin 1.11.0pre. Unfortunately there is currently no pre-release build on NuGet, so it is currently necessary to download jquery.validation.js directly from GitHub: jQuery.Validation 1.11 is now available via NuGet (thanks @Simon_Weaver). UPDATE It looks like general support for jQuery 1.9 is in the jQuery.Validation code base but not …

Read more

When form is validated, how to SCROLL to the first error instead of jumping?

Here’s what you can do: By default the validate plugin focuses the first erroneous element (in case there’s any). Turn off the option focusInvalid by setting it to false. The callback invalidHandler handler is executed when the form is invalid. You get access through the second parameter validator to the validator object and thus to …

Read more

Custom Error Label Placement using jQuery validate (For all or some of your errors)

So if you want all your jQuery Validate error messages to appear in one place you would use http://docs.jquery.com/Plugins/Validation/validate#toptions (Find errorPlacement) option on that page. I noticed some answers on here answer one but not both options. 1) That being said if you want custom placement for all of your errors you can do this: …

Read more

jQuery Validation plugin – Validating hidden inputs and not visible? [duplicate]

To allow validation of hidden elements, override the ignore and set it to empty string: $(“#form1”).validate({ ignore: “”, rules: { something: { number:true, min:1, required:true } } }); You can use ignore option like this: $(“#form1”).validate({ ignore: “input[type=”text”]:hidden”, rules: { something: { number:true, min:1, required:true } } }); Default value of ignore option is :hidden …

Read more

MVC 4 client side validation not working

I had the same problem. It seems that the unobtrusive validation scripts were not loaded (see screenshot at the end). I fixed it by adding at the end of _Layout.cshtml @Scripts.Render(“~/bundles/jqueryval”) The end result: @Scripts.Render(“~/bundles/jquery”) @Scripts.Render(“~/bundles/jqueryval”) @RenderSection(“scripts”, required: false) Except for my pretty standard CRUD views everything is Visual studio project template defaults. Loaded scripts …

Read more

jquery validate check at least one checkbox

Example from https://github.com/ffmike/jquery-validate <label for=”spam_email”> <input type=”checkbox” class=”checkbox” id=”spam_email” value=”email” name=”spam[]” validate=”required:true, minlength:2″ /> Spam via E-Mail </label> <label for=”spam_phone”> <input type=”checkbox” class=”checkbox” id=”spam_phone” value=”phone” name=”spam[]” /> Spam via Phone </label> <label for=”spam_mail”> <input type=”checkbox” class=”checkbox” id=”spam_mail” value=”mail” name=”spam[]” /> Spam via Mail </label> <label for=”spam[]” class=”error”>Please select at least two types of spam.</label> The …

Read more