You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Lars Kruse Pedersen (JIRA)" <de...@myfaces.apache.org> on 2006/01/03 14:28:02 UTC

[jira] Created: (MYFACES-997) Using onbeforeunload together with InputCalendar does not work properly...

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


[jira] Commented: (MYFACES-997) Using onbeforeunload together with InputCalendar does not work properly...

Posted by "Lars Kruse Pedersen (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/MYFACES-997?page=comments#action_12361737 ] 

Lars Kruse Pedersen commented on MYFACES-997:
---------------------------------------------

Actually there are 2 other places in the popcalendar.js, where the '<a href' tag is used,  the cross for closing the calender, and for selecting the current moth, though not as used, these tags should also be replaced with '<span' tags...




> 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