asp.net mvc - JQuery and JQuery.Validate "Unable to get property 'call' of undefined or null reference" error -
i have asp.net mvc 5 application using jquery v1.10.2 , jquery.validate v1.13.1 , getting following error in chrome when validating form clicking "submit" or when input validated after losing focus:
and internet explorer gives me same error.
i using bundle system bundle different scripts , maintained in project (which shared between applications making code maintainable in 1 place). bundles this:
bundletable.bundles.add(new scriptbundle(bundlenames.javascript.jquery).include( string.format("~/{0}/jquery-1.10.2.js",_javascriptfolder""), string.format("~/{0}/jquery-1.10.2.min.js",_javascriptfolder), string.format("~/{0}/jquery-migrate-1.2.1.js",_javascriptfolder), string.format("~/{0}/jquery-migrate-1.2.1.min.js",_javascriptfolder))); bundletable.bundles.add(new scriptbundle(bundlenames.javascript.jqueryvalidation).include( string.format("~/{0}/jquery.validate.js",_javascriptfolder), string.format("~/{0}/jquery.validate.min.js",_javascriptfolder), string.format("~/{0}/jquery.validate.unobtrusive.js",_javascriptfolder), string.format("~/{0}/jquery.validate.unobtrusive.min.js",_javascriptfolder), string.format("~/{0}/jquery.validate-vsdoc.js", _javascriptfolder)));
and included applications layout view so:
@scripts.render(ebi.mvc.library.bundling.bundlenames.javascript.jquery) @scripts.render(ebi.mvc.library.bundling.bundlenames.javascript.jqueryvalidation)
this setup working fine when jquery v1.9.1 , jquery.validate v1.10.0 being used had update jquery.validate , decided update jquery (i avoiding 2.x because of ie compatibility reasons), since have been stuck error. have tried changing original versions working ok oddly error still occurring.
i have looked @ answer this question (which seems practically identical) , installed jquery migrate plugin using nuget package manager, , added jquery bundle, seemed stop error being thrown page containing form loaded.
i add after error thrown validation still takes place on form (e.g. adding validation classes inputs , displaying input errors).
can me figure out causing error?
in scenario, turns out sparky said using minified , un-minifed versions of same script causing issue.
to resolve split bundles minifed , un-minified versions makes both types usable in application if required.
bundletable.bundles.add(new scriptbundle(bundlenames.javascript.jquery).include( string.format("~/{0}/jquery-1.9.1.js",_javascriptfolder))); bundletable.bundles.add(new scriptbundle(bundlenames.javascript.jquerymin).include( string.format("~/{0}/jquery-1.9.1.min.js", _javascriptfolder))); bundletable.bundles.add(new scriptbundle(bundlenames.javascript.jqueryvalidation).include( string.format("~/{0}/jquery.validate.js",_javascriptfolder), string.format("~/{0}/jquery.validate.unobtrusive.js",_javascriptfolder))); bundletable.bundles.add(new scriptbundle(bundlenames.javascript.jqueryvalidationmin).include( string.format("~/{0}/jquery.validate.min.js",_javascriptfolder), string.format("~/{0}/jquery.validate.unobtrusive.min.js", _javascriptfolder)));
since doing able update jquery.validate plugin without error occurring. didn't have use jquery migrate plugin in end either.
so guess if else gets error worth checking aren't referencing both minified , un-minified versions of jquery , jquery validate scripts.
the confusing bit on half still don't have answer bundles (as coded in question description) setup way on year no errors ever occurring , multiple applications having made use of it, until tried updating plugin...
Comments
Post a Comment