Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Valerie on Oct 17, 2008 02:58
open dhtmlx forum
Unable selection of future dates and flexible changing of year/month

Hi all,

I am just wondering if it possible to set the dthmlxcalendar so that it won't allow selection of future dates but only past dates. And is it also possible to allow user to directly change the year and month? For example, i would like to use dhtmlxcalendar as a calendar for user to select their birth dates. So it can be a hassle if i have to click the arrows back many years later. Any solution? Thanks
Answer posted by Support on Oct 17, 2008 05:54
>>selection of future dates but only past dates

          calObj.setSensitive(null,new Date());

http://dhtmlx.com/docs/products/dhtmlxCalendar/samples/initialization/calendar_sensitive.html?un=1224249330000

>> And is it also possible to allow user to directly change the year and month?

  mCal2 = new dhtmlxCalendarObject('dhtmlxCalendar2', false, {isYearEditable: true,isMonthEditable: true});

http://dhtmlx.com/docs/products/dhtmlxCalendar/samples/initialization/calendar_init.html?un=1224249376000


Answer posted by Valerie on Oct 17, 2008 07:11
Hi,

Thanks for the answer. Anyway it works except for this link of code:
mCal2 = new dhtmlxCalendarObject('dhtmlxCalendar2', false, {isYearEditable: true,isMonthEditable: true});

Mine would only work if it was:
mCal2 = new dhtmlxCalendarObject('dhtmlxCalendar2', true, {isYearEditable: true,isMonthEditable: true});

Not sure why though, but thanks anyway.
Answer posted by Support on Oct 17, 2008 09:16
In first case you will need to add 
          mCal2.draw(); 
to render calendar object, in second case it is executed automatically while construction.
Both ways of init are valid.
Answer posted by Valerie on Oct 20, 2008 21:07
Oh okay, i didn't know that. Thanks!