Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Craig Efrein on Jan 27, 2009 01:29
open dhtmlx forum
calendar - error loading page in IE6

hello,

I am loading the calendar with the following command
<script>
dhtmlxcal1 = new dhtmlxCalendarObject('job_date', true {isYearEditable: true,isMonthEditable: true});
</script>

and IE6 says that it can not load the page. If I load the calendar with rendering set to false like this
<script>
dhtmlxcal1 = new dhtmlxCalendarObject('job_date', false {isYearEditable: true,isMonthEditable: true});
</script>

IE6 loads the page and the calendar works. I get the same error if I add the following command when the page is loaded into the browser
dhtmlxcal1.draw(); If I run draw() after the page is loaded from an onClick event, I don't get any errors.

It is important to render the calendar when the page is loaded so that when I click on an input with a date, the date of the input is selected in the calendar.

Thanks,
Craig


Answer posted by Support on Jan 27, 2009 02:37
The syntax which you are using is incorrect, the comma after "true" is missed

<script> 
dhtmlxcal1 = new dhtmlxCalendarObject('job_date', true, {isYearEditable: true,isMonthEditable: true}); 
</script>

>> If I run draw() after the page is loaded from an onClick event, I don't get any errors.
Please be sure that container used for calendar , "job_date" is already rendered, on moment of js code execution. You need not wait page loading end , but must place calendar rendering code only after related HTML container rendered on page. 

Answer posted by Craig Efrein on Jan 27, 2009 02:58
I actually had it with a comma, it just got cut off when I sent this question

dhtmlxcal1 = new dhtmlxCalendarObject('job_date', true, {isYearEditable: true,isMonthEditable: true});

but I'm still getting the same error in IE.   The calendar is created at the bottom of the page and I know for sure that the container 'job_date' exists.  I don't get any errors in firefox, just in IE.

The problem is still the same, if I create the calendar object
dhtmlxcal1 = new dhtmlxCalendarObject('job_date', true, {isYearEditable: true,isMonthEditable: true});
or attempt to draw it
dhtmlxcal1.draw();

IE says that it can't load the page.

Craig
Answer posted by Support on Jan 27, 2009 05:13
There is a known bug in IE, which cause similar error when some contents created dynamically in the top level, from script inside some not closed yet tag ( the script block placed inside some not closed container )

Please try to change your code as 

dhtmlxcal1 = new dhtmlxCalendarObject('job_date', false, {isYearEditable: true,isMonthEditable: true});
dhtmlxEvent(window,"load",function(){ dhtmlxcal1.draw(); });