dhtmlxCalendar to pick a number of dates

Hi there,

I have an input field, and I’d like to pick a series of dates to put in there.
For example:

  • The input field would initially be blank.
  • I would click into it, the calendar opens.
  • I click January 1st.
  • Input field now contains: 2011-01-01.
  • I click into the field again, the calendar opens again.
  • I click February 2nd.
  • Input field now contains: 2011-01-01, 2011-02-02.

I have tried to block the onClick event so that I could catch the selected date and manually append it to the input, instead of the calendar overwriting it. But returning false doesn’t stop this behaviour. Has anyone got any suggestions?

Thanks!

I expected the code below to stop the selected date being pushed into the input field, but no joy :frowning:

var cal = new dhtmlxCalendarObject(["input1"]);
cal.attachEvent("onClick", function (date) {
	// select input and append the string returned by the cal.getDate() function
	return false;
});

Hi,

in case of custom input values, you should not built-in input attaching. You may use approach that is used in the following sample to attach calendar to an input and manage input value as you want:

dhtmlxCalendar/samples/01_initialization/07_calendar_sensitive.html