You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Werner Lehmann <le...@media-interactive.de> on 2005/09/08 15:39:45 UTC

DatePicker / overlib compatibility issue (Javascript)

Hi,

I have a problem with the datepicker component when used in combination 
with the overlib popup/hint javascript library (1) on Mozilla based 
browsers. Pages which use either datepicker or overlib work perfectly, 
but if a page requires both datepicker and hints the datepicker does not 
popup on Firefox. The hints work though. Usually no problem on IE (there 
is only one case reported when it did not work in IE either).

The error message in the Firefox JS console is

> Error: calendar_datePicker has no properties
> Source File: javascript:calendar_datePicker.toggle(document.Form0.datePicker);
> Line: 1

With Venkman (a javascript debugger) I can see that the 
calendar_datePicker variable is "void" which explains the "has no 
properties" error message.

I suppose the problem is this: the calendar variable would be 
initialized in window.onLoad:

> window.onload = function ()
> {
> calendar_datePicker = new Calendar();
...

But overlib brings its own onLoad function which apparently suppresses 
the calendar's onLoad. This is the onLoad code snippet from overlib:

> // Add window onload handlers to indicate when all modules have been loaded
> // For Netscape 6+ and Mozilla, uses addEventListener method on the window object
> // For IE it uses the attachEvent method of the window object and for Netscape 4.x
> // it sets the window.onload handler to the OLonload_handler function
> if(window.addEventListener) window.addEventListener("load",OLonLoad_handler,true);
> else if (window.attachEvent) window.attachEvent("onload",OLonLoad_handler);
> else window.onload=OLonLoad_handler;

...

> // Onload handler for window onload event
> function OLonLoad_handler(e) {
> 	if (!olLoaded) olLoaded=1;  // indicates that all modules have loaded now
> 
> 	// remove the OLonload_handler for Ns6+, Mozilla based browsers, and IE
> 	if (window.removeEventListener) window.removeEventListener("load",OLonLoad_handler,true);
> 	else if (window.detachEvent) window.detachEvent("onload",OLonLoad_handler);
> 	
> 	// Route the event to the normal handler in Nx4.x
> 	if (olNs4) routeEvent(e);
> }

Any ideas how to make both compatible?

Werner



(1) http://www.bosrup.com/web/overlib

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: DatePicker / overlib compatibility issue (Javascript)

Posted by Werner Lehmann <le...@media-interactive.de>.
Hi Jesse,

thanks but that did not work either. The code in the function (the 
"observer") is not executed. Fortunately it turns out that this is a bug 
in overlib 4.00 which suppressed all window.onLoad functions. At least 
in the current version 4.21 this seems to be fixed.

Werner


Jesse Kuhnert wrote:
> You could make overlib use prototype to do it's onload event capture logic. 
> See http://www.sergiopereira.com/articles/prototype.js.html.
> 
> The code you'd want to look at might be something like this:
> 
> Event.observe(window, 'load', showMessage, false);
> 
> 
> jesse
> 
> On 9/8/05, Werner Lehmann <le...@media-interactive.de> wrote:
> 
>>Hi,
>>
>>I have a problem with the datepicker component when used in combination
>>with the overlib popup/hint javascript library (1) on Mozilla based
>>browsers. Pages which use either datepicker or overlib work perfectly,
>>but if a page requires both datepicker and hints the datepicker does not
>>popup on Firefox. The hints work though. Usually no problem on IE (there
>>is only one case reported when it did not work in IE either).
>>
>>The error message in the Firefox JS console is
>>
>>
>>>Error: calendar_datePicker has no properties
>>>Source File: javascript:calendar_datePicker.toggle(
>>
>>document.Form0.datePicker);
>>
>>>Line: 1
>>
>>With Venkman (a javascript debugger) I can see that the
>>calendar_datePicker variable is "void" which explains the "has no
>>properties" error message.
>>
>>I suppose the problem is this: the calendar variable would be
>>initialized in window.onLoad:
>>
>>
>>>window.onload = function ()
>>>{
>>>calendar_datePicker = new Calendar();
>>
>>...
>>
>>But overlib brings its own onLoad function which apparently suppresses
>>the calendar's onLoad. This is the onLoad code snippet from overlib:
>>
>>
>>>// Add window onload handlers to indicate when all modules have been 
>>
>>loaded
>>
>>>// For Netscape 6+ and Mozilla, uses addEventListener method on the 
>>
>>window object
>>
>>>// For IE it uses the attachEvent method of the window object and for 
>>
>>Netscape 4.x
>>
>>>// it sets the window.onload handler to the OLonload_handler function
>>>if(window.addEventListener) window.addEventListener
>>
>>("load",OLonLoad_handler,true);
>>
>>>else if (window.attachEvent) window.attachEvent
>>
>>("onload",OLonLoad_handler);
>>
>>>else window.onload=OLonLoad_handler;
>>
>>...
>>
>>
>>>// Onload handler for window onload event
>>>function OLonLoad_handler(e) {
>>>if (!olLoaded) olLoaded=1; // indicates that all modules have loaded now
>>>
>>>// remove the OLonload_handler for Ns6+, Mozilla based browsers, and IE
>>>if (window.removeEventListener) window.removeEventListener
>>
>>("load",OLonLoad_handler,true);
>>
>>>else if (window.detachEvent) window.detachEvent
>>
>>("onload",OLonLoad_handler);
>>
>>>// Route the event to the normal handler in Nx4.x
>>>if (olNs4) routeEvent(e);
>>>}
>>
>>Any ideas how to make both compatible?
>>
>>Werner
>>
>>
>>
>>(1) http://www.bosrup.com/web/overlib
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 


-- 
MINT MEDIA INTERACTIVE Software Systems GmbH
Kieler Innovations- und Technologiezentrum
Schauenburgerstrasse 116
D-24118 Kiel
Germany
phone   +49 - 431 - 5606 414
fax     +49 - 431 - 5606 418
mail    lehmann@media-interactive.de

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: DatePicker / overlib compatibility issue (Javascript)

Posted by Jesse Kuhnert <jk...@gmail.com>.
You could make overlib use prototype to do it's onload event capture logic. 
See http://www.sergiopereira.com/articles/prototype.js.html.

The code you'd want to look at might be something like this:

Event.observe(window, 'load', showMessage, false);


jesse

On 9/8/05, Werner Lehmann <le...@media-interactive.de> wrote:
> 
> Hi,
> 
> I have a problem with the datepicker component when used in combination
> with the overlib popup/hint javascript library (1) on Mozilla based
> browsers. Pages which use either datepicker or overlib work perfectly,
> but if a page requires both datepicker and hints the datepicker does not
> popup on Firefox. The hints work though. Usually no problem on IE (there
> is only one case reported when it did not work in IE either).
> 
> The error message in the Firefox JS console is
> 
> > Error: calendar_datePicker has no properties
> > Source File: javascript:calendar_datePicker.toggle(
> document.Form0.datePicker);
> > Line: 1
> 
> With Venkman (a javascript debugger) I can see that the
> calendar_datePicker variable is "void" which explains the "has no
> properties" error message.
> 
> I suppose the problem is this: the calendar variable would be
> initialized in window.onLoad:
> 
> > window.onload = function ()
> > {
> > calendar_datePicker = new Calendar();
> ...
> 
> But overlib brings its own onLoad function which apparently suppresses
> the calendar's onLoad. This is the onLoad code snippet from overlib:
> 
> > // Add window onload handlers to indicate when all modules have been 
> loaded
> > // For Netscape 6+ and Mozilla, uses addEventListener method on the 
> window object
> > // For IE it uses the attachEvent method of the window object and for 
> Netscape 4.x
> > // it sets the window.onload handler to the OLonload_handler function
> > if(window.addEventListener) window.addEventListener
> ("load",OLonLoad_handler,true);
> > else if (window.attachEvent) window.attachEvent
> ("onload",OLonLoad_handler);
> > else window.onload=OLonLoad_handler;
> 
> ...
> 
> > // Onload handler for window onload event
> > function OLonLoad_handler(e) {
> > if (!olLoaded) olLoaded=1; // indicates that all modules have loaded now
> >
> > // remove the OLonload_handler for Ns6+, Mozilla based browsers, and IE
> > if (window.removeEventListener) window.removeEventListener
> ("load",OLonLoad_handler,true);
> > else if (window.detachEvent) window.detachEvent
> ("onload",OLonLoad_handler);
> >
> > // Route the event to the normal handler in Nx4.x
> > if (olNs4) routeEvent(e);
> > }
> 
> Any ideas how to make both compatible?
> 
> Werner
> 
> 
> 
> (1) http://www.bosrup.com/web/overlib
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>