myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Robinson (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (TOMAHAWK-261) Do not use document.write in popup calendars
Date Fri, 28 Apr 2006 15:13:38 GMT
    [ http://issues.apache.org/jira/browse/TOMAHAWK-261?page=comments#action_12376951 ] 

Andrew Robinson commented on TOMAHAWK-261:
------------------------------------------

Not looking too good.

1) It doesn't work when the calendar is positioned inside of absolute positioned elements.
I clicked on the button, and my scrollbars changed (grew), but the calendar never appeared.
I have the popup calendar parent control positioned absolute inside of an absolute DIV that
has a fairly high z-order (~500). 

2) Document.write is still being used. Here is the JavaScript that was rendered by the control:
var zfpForm_3A_5Fid235CalendarVar=new org_apache_myfaces_PopupCalendar();
zfpForm_3A_5Fid235CalendarVar.initData.imgDir = "/StormPeak/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/11462360/calendar.HtmlCalendarRenderer/DB/";
zfpForm_3A_5Fid235CalendarVar.initData.monthName = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
zfpForm_3A_5Fid235CalendarVar.initData.dayName = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
zfpForm_3A_5Fid235CalendarVar.initData.startAt = 0;
zfpForm_3A_5Fid235CalendarVar.dateFormatSymbols.weekdays = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
zfpForm_3A_5Fid235CalendarVar.dateFormatSymbols.shortWeekdays = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
zfpForm_3A_5Fid235CalendarVar.dateFormatSymbols.shortMonths = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
zfpForm_3A_5Fid235CalendarVar.dateFormatSymbols.months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
zfpForm_3A_5Fid235CalendarVar.dateFormatSymbols.eras = new Array("BC","AD");
zfpForm_3A_5Fid235CalendarVar.dateFormatSymbols.ampms = new Array("AM","PM");
zfpForm_3A_5Fid235CalendarVar.initData.popupLeft = false;

zfpForm_3A_5Fid235CalendarVar.init(document.getElementById('zfpForm:_id235Span'));

if (!document.layers) {
document.write('<input type="button" onclick="zfpForm_3A_5Fid235CalendarVar._popUpCalendar(this,document.getElementById(\'zfpForm:_id235\'),\'M/d/yy\')"
value="..." />');
}

You can see the document.write at the bottom. Despite being inside of an if statement, the
presence of the document.write causes errors in AjaxAnywhere.

> Do not use document.write in popup calendars
> --------------------------------------------
>
>          Key: TOMAHAWK-261
>          URL: http://issues.apache.org/jira/browse/TOMAHAWK-261
>      Project: MyFaces Tomahawk
>         Type: Improvement

>   Components: Calendar, Date
>     Versions: 1.1.2-SNAPSHOT, 1.1.1, 1.1.3-SNAPSHOT
>     Reporter: Andrew Robinson
>     Assignee: Martin Marinschek
>     Priority: Blocker

>
> The popup calednar for the date control (and I think the calendar control) uses javascript
"document.write" methods. Unfortunately this is not very compatible with AJAX as it is hard
to write content to the document after the document is closed.
> Instead, can this be changed to have: 
> A) printed hidden component  (visibility: hidden; display: none) and just shown when
the user clicks the popup button.
> or 
> B) Use the DOM JavaScript API to add new elements to the DOM instead of document.write.
> Unless this is changed, these controls cannot be used with AjaxAnywhere and probably
not with other AJAX solutions.

-- 
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


Mime
View raw message