Calendar setYearsRange error

Hi.



I try to integrate dhtmlxDblCalendar on my joomla portal, but I have one problem.



When I put the following lines oh my php code:



$document->addScriptDeclaration("

window.onload = function () {

    var mDCal;

        mDCal = new dhtmlxDblCalendarObject(‘dhtmlxDblCalendar’, false, {isMonthEditable: true, isYearEditable: true});        

        mDCal.setDateFormat(’%d/%m/%Y’);

        mDCal.setDate(‘06/01/2008’,‘15/01/2008’);

mDCal.setYearsRange(1980, 2020);

        mDCal.draw();

        mDCal.setOnClickHandler(function(date){

alert(date);

})

    }

");



It�s get me the next error:



Error: cs[ind].options has no properties

File: dhtmlxcalendar.js

Line: 21



If a delete “mDCal.setYearsRange(1980, 2020);”, calendar works perfectly.



I try to put generated html code directly on the php file, but     it continues the same mistake.



Does anyone know why this happen?



Thanks for the time.

Problem may be caused by using some js code which extends base array object and as result corrupts calendar logic.
Please try to use attached js file instead of original one.

dhtmlxcalendar.zip (11.8 KB)

Thanks for your quick answer. I resolved it with your script.

But I have a simple doubt. Can I attach an event to the change month button?

Thanks for the time.


Calendar provides only one public event - “onClick” - which occurs when date selected, there is no separate event on month changing.
( Basically it can be added by small code modification, but there are few different ways how month can be changed )

Yes. I see it.

But I decide to do only one: through the previous-next month button. The calendar isn´t editable on year and month.

Do you know where i have to change code?

Thanks again.

You can add any custom code to the next lines

dhtmlxcalendar.js , line 667

    cArLeft.onclick = function(){ self.prevMonth() }

dhtmlxcalendar.js , line 674
    cArRight.onclick = function(){ self.nextMonth() }

Thanks again for your quick answer!!

I will test the solution.

Your page and your support are wonderful. Thanks and congratulations.