Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by EclipseTalk on Jan 21, 2009 07:43
open dhtmlx forum
DHTMLX Calendar - Cannot set year and month editable

Hello,
I'm creating 2 calendars, cal1 and cal2.
cal1 doesn't display. I'd like to add the month and year editable. Cal2 works fine as long as I don't specify parameters to the dhtmlxCalendarObject call. This code was taken from the livedemo. I tried using the downloadable source code but I run into issues when I use the code bellow. Does any one know what is happening?
Thanks in advance for your help.

<script>
var cal1,cal2;
window.onload=function()
{
     cal1=new dhtmlxCalendarObject('calendar1', false, {isMonthEditable:true, isYearEditable:true});
     cal1.sA(selectDate1);
     cal2=new dhtmlxCalendarObject('calendar2');
     cal2.sA(selectDate2);
    };         
    function selectDate1(date)
    {
        document.getElementById('searchStartDate').value=cal1.Ul(null,date);
         document.getElementById('calendar1').style.display='none';
    };
         
    function selectDate2(date)
{
        document.getElementById('searchEndDate').value=cal2.Ul(null,date);
         document.getElementById('calendar2').style.display='none';
    };
         
    function rb(k)
{
document.getElementById('calendar'+k).style.display='block';
}
</script>

Answer posted by Support on Jan 21, 2009 10:00
You creating calendar object with auto-draw disabled ( second parameter of constructor set to false ), so you will need to execute a draw command manually

 cal1=new dhtmlxCalendarObject('calendar1', false, {isMonthEditable:true, isYearEditable:true}); 
 cal1.sA(selectDate1);
 cal1.draw();

or just change false to true in constructor of calendar


Answer posted by EclipseTalk on Jan 21, 2009 11:53

When I set the second parameter to true, the calendar display fine but I still can't edit month and year.

I used the sample code found on http://dhtmlx.com/docs/products/dhtmlxCalendar/samples/initialization/calendar_sensitive.html">http://dhtmlx.com/docs/products/dhtmlxCalendar/samples/initialization/calendar_sensitive.html I've tested on IE 6.0, and the calendar cannot set the date other browsers are ok. Which codebase should I use for the sample in the link above?

Thank you

Answer posted by EclipseTalk on Jan 21, 2009 12:55

What would be the corresponding code for the statement: cal1.sA(selectDate1);

and document.getElementById('earchStartDate').value=cal1.Ul(null,date);

The function sA and UI are compressed. Thank you for your valuable help.

Answer posted by Support on Jan 22, 2009 05:19
>>When I set the second parameter to true, the calendar display fine but I still can't edit month and year.
Please check attached sample

>>What would be the corresponding code for
I'm not sure, this is obfuscated code, you can check the same samples in downloadable package - it contains full, not obfuscated code
Attachments (1)