This is a migrated thread and some comments may be shown as answers.

[Solved] Why try to load jquery.validate.js if ScriptRegistrar.jQuery(false)

2 Answers 138 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
balticer
Top achievements
Rank 1
balticer asked on 25 Jan 2011, 02:12 PM
Hi there,

is this a reasonable behaviour that Telerik.Web.Mvc is try to load the 'jquery.validate.js' script if 'jQuery(false)' is used? I think a better behaviour is to not try to load it or add a jQueryValidate(false) or something like that. Currently i use a patch to change it, so that 'jquery.validate.js' isn't load anymore if 'jQuery(false)' is used. Maybe there is another solution?

Patch (not fully tested yet):
// change line 33 in Telerik.Web.Mvc.UI.ScriptRegistrar (ScriptRegistrar.cs)
private static readonly IList<string> frameworkScriptFileNames = new List<string> { jQuery }; //old
private static readonly IList<string> frameworkScriptFileNames = new List<string> { jQuery, jQueryValidation }; //new
 
// comment line 611 in  Telerik.Web.Mvc.UI.Grid (Grid.cs)
// (i'm wonder that's the only file where this is used)
ScriptFileNames.Add("jquery.validate.js"); // old
// ScriptFileNames.Add("jquery.validate.js"); // new

I use the currently available open source download version from the telerik site.

regards
Kai

2 Answers, 1 is accepted

Sort by
0
Danan
Top achievements
Rank 1
answered on 23 Feb 2011, 10:04 PM
I agree, it is a bit confusing.  When you specify .jQuery(false) you would expect telerik not to load any jquery files.  We actually load all of our javascript files another way, so this was causing issues b/c the file was coming down twice.  What I ended up doing was adding an empty file called jquery.validate.js to the scripts folder so telerik would not blow up. Well, it wasn't completely empty (there was a "nice" comment in there about telerik's assumptions). :)  I think adding an empty file is preferable to editing the source, if you can do so.
0
balticer
Top achievements
Rank 1
answered on 21 Mar 2011, 11:12 AM
Hi Danan,

actually this is the best solution. I'll prefer this over patching the code. Thx.

regards
Kai
Tags
General Discussions
Asked by
balticer
Top achievements
Rank 1
Answers by
Danan
Top achievements
Rank 1
balticer
Top achievements
Rank 1
Share this question
or