Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by janelastur on Apr 19, 2008 04:33
open dhtmlx forum
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.
Answer posted by Support on Apr 21, 2008 02:13
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.
Attachments (1)
Answer posted by janelastur on Apr 21, 2008 10:20
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.


Answer posted by Support on Apr 22, 2008 02:10
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 )
Answer posted by janelastur on Apr 22, 2008 02:32
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.
Answer posted by Support on Apr 22, 2008 03:50
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() }
Answer posted by janelastur on Apr 22, 2008 04:03
Thanks again for your quick answer!!

I will test the solution.

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