Disabled calendars in form with XML

Hello,

I’ve a dhtmlxform with 5 differents items (type = “calendar”).

I use it for : display dates in good format (with dateformat) and let the user change the dates with the calendar

But for 2 of the 5 dates field i don’t want let the user able to change the dates. I want only display the date.
If i use readonly directive in xml file, the user can’t change the date in the field but can change the date with the calendar.

How can i disable the calendar but keep the dateformat for those 2 dates ?

Thanks in advance for any answer

@++
JC

Hello,

you may disable dates using setSensitiveRange(start,end) method of the calendar. And calendar date is defined, you may use the following approach to make only this date available:

var myCalendar = myForm.getCalendar(“start_date”);
var date = myCalendar.getDate()
myCalendar.setSensitiveRange(date,date);

Hello Alexandra,

Thanks, yes it works great except the case where the date is not defined : all the dates in the calendar are open.

Any solution about this case ?

Thanks in advance

@++
JC

You can make calendar item disabled:

{item:“calendar”, disabled:1, …}