Using onbeforeunload together with InputCalendar does not work properly...
--------------------------------------------------------------------------

         Key: MYFACES-997
         URL: http://issues.apache.org/jira/browse/MYFACES-997
     Project: MyFaces
        Type: Bug
  Components: Tomahawk  
    Versions: 1.1.1    
 Environment: Windows XP SP2, IE 6.0, JBoss 4.0.2, MyFaces 1.1.1
    Reporter: Lars Kruse Pedersen
    Priority: Minor


This bug only affects the IE6.0(and probably other versions), it works fine i 
FF1.5, not testet on Opera or other browsers...

If the onbeforeunload handler is used together with the inputCalendar then when 
selecting a date the onbeforeunload handler is run, popping up a dialog asking 
if you want to leave this page!?!?! Not very cool :-(

The problem occurs  because a '<a href' tag is used when selecting the date in 
the date dialog, which unnessary  triggers the onbeforeunload handler ( see 
http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onbeforeunload.asp
 )

The current code used to select a date:

sHTML += "<a class='"+sStyle+"' "+dateMessage+" title=\"" + sHint + "\" 
href='javascript:jscalendarDateSelected="+datePointer+";jscalendarCloseCalendar();'
 onmouseover='this.className=\""+sSelectStyle+"\";' >&#160;" + datePointer + 
"&#160;</a>";

one solution is to use a '<span' tag, together with a onclick handler:

sHTML += "<span class='"+sStyle+"' "+"style='cursor: pointer;' "+dateMessage+" 
title=\"" + sHint + "\" 
onclick='javascript:jscalendarDateSelected="+datePointer+";jscalendarCloseCalendar();'
 onmouseover='this.className=\""+sSelectStyle+"\";' >&#160;" + datePointer + 
"&#160;</span>";

Notice that I have put an extra style on the original tag to show the cursor 
when hovering over the dates in the dialog. This style should probably be put 
into the orginal style class...

The solution has been tested and works fine in both IE6.0 and FF1.5 :-)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to