This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

sfLightWindowPlugin vs. other Javascript helpers

Forum to discuss ExtJS and other JS plugins

sfLightWindowPlugin vs. other Javascript helpers

by djoos » Fri Oct 03, 2008 6:19 pm


Recently I've got a very annoying issue with the sfLightWindowPlugin, when using it together with another Javascript helper on a page (in my case: the input_auto_complete_tag) - resulting in a "Ajax.Autocompleter is not a constructor" Javascript error.
As described in Aaron Johnson's blog, it is an easy thing to solve - but we have to think about a solution within the Symfony context over here :)~ :-)~ :smile:

Solution: first of all I made sure to replace the core javascript-libraries of Symfony (located in sf/prototype/js) with later versions, by making use of the sfPrototypePlugin.
Ok, this still doesn't solve the issue of the double addition of the .js-files. But, in order to solve that, I modified the LightWindowHelper so that before executing "$response-> addJavascript(sfConfig::get('sf_lightwindow_prototype_dir'). 'prototype.js');", a check is done whether prototype hasn't been included yet. The getJavascripts-method on the sfWebResponse-class proved to be very handy there.
Now it's very simple: if prototype was already included, don't bother to include it again.

Results: both the input_auto_complete_tag and the lw_button (or whathever sfLightWindowPlugin-helper) can be used, without having conflicting additions of prototype.js.

I guess this kind of "test before including something another time" would be handy - actually I guess it would be even more handy if it was a parameter in the addJavascript-method...
Faithful Member
Posts: 290
Joined: Mon Aug 13, 2007 1:29 pm
Location: London