Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Feb 09, 2009 17:17
open dhtmlx forum
dhtmlxCalendar won't show

I am on dhtmlxGrid v.2.0 Professional edition build 81009
I have the following code in firefox, which gives java script error and calender doesn't show up.
<script>
cal9 = new dhtmlxCalendarObject('question_9',false,{isYearEditable :true});
cal9.setDateFormat('%m/%d/%Y');
cal9.setDate('');
cal9.draw();

</script>
<div>
<span>
<input id="question_9" class="css1" type="text"/>
<label for="question_9_year">mm/dd/yyyy</label>
</span>
</div>

Error:
this.con is null
onmousemove()()dhtmlxcalendar.js (line 50)
startDrag()(undefined)
Answer posted by Alex (support) on Feb 10, 2009 07:13

Please, try replace the code of calendar initialization after html code of containers or it can be called on body onload:

<div> 
<span> 
<input id="question_9" class="css1" type="text"/> 
<label for="question_9_year">mm/dd/yyyy</label> 
</span> 
</div>

<script> 
cal9 = new dhtmlxCalendarObject('question_9',false,{isYearEditable :true}); 
cal9.setDateFormat('%m/%d/%Y'); 
cal9.setDate(''); 
cal9.draw(); 

</script> 

 

Answer posted on Feb 10, 2009 08:01
With switching, it works in Firefox but not in IE 6. In IE 6, page doesn't load.
Answer posted by Alex (support) on Feb 10, 2009 09:46

Please, try to intialize calendar on body onload:

<body onload="init()">

...

<script>

function init(){ 
cal9 = new dhtmlxCalendarObject('question_9',false,{isYearEditable :true}); 
cal9.setDateFormat('%m/%d/%Y'); 
cal9.setDate(''); 
cal9.draw();


</script>

Answer posted on Feb 10, 2009 12:18
That did the trick. Thanks!