No user function when date is changed

I need to execute a function when the date in a calendar is changed. the function IS executed properly when the date is initially chosen, but not if the user goes back and change the date. this is a real problem for me since in my application, different dates imply different pricings.

here is the setup code I am using:

var sacoboundCalendar;
function doOnLoad() {
	sacoboundCalendar = new dhtmlXCalendarObject(["calendarSacobound"]);
	sacoboundCalendar.setInsensitiveDays(["<?php echo $SacoboundBlackoutDates ?>"]);

	var myEvent = sacoboundCalendar.attachEvent("onClick", function (){
		//event handler code

var fiddleheadCalendar;
	fiddleheadCalendar = new dhtmlXCalendarObject(["calendarFiddlehead"]);
	fiddleheadCalendar.setInsensitiveDays(["<?php echo $FiddleheadBlackoutDates ?>"]);

	var myEvent = fiddleheadCalendar.attachEvent("onChange", function (){
		//event handler code
		// alert("change");

you can see a demo with the issue here:

thank you

you can see the difference between date pricing by going to teh Fiddlehead camping block on the page, selecting today’s date, selecting the other options, and look at the deposit required field. then change the date only to July 27, 2012. the price does not change.

without this function I am putting onmouseover events on all possible fields to insure that the pricing is changes. certainly not optimal!!!

any help/response would be very appreciated…

We can’t reproduce the issue.
Based on your code I made a demo. The first calendar for onClick and the second for onChange events.
Everything works fine.
Pay attention to that both events need to be used on the same calendar, because onClick by other date is the same like onChange.

Here is documentation about Calendar events: … dar_events

My demo is attached
calendar_events.rar (34.5 KB)

I downloaded the example you created and onChange doesn’t work in it either. I don’t need onClick, because that happens BEFORE the date is changed. I need the user event to be triggered AFTER the date is changed. the docs say:

“Fires when a user changes month, year or time in selector.”

however it does not happen that way. it triggers when the date is clicked. I have the date picker attached to a field so that the picker pops up when the field is clicked.

I’ve downloaded this sample too. It works.
Sorry for stupid question: how do you do this changes?
I hope, such way as in the picture?

You can also use a variable to trace a revision on the event. If you don’t need onClick now - it for you for the future.

var selectedDate; calendar.attachEvent("onClick",function(date){ if(date!=selectedDate){ /*changed actions*/ } selectedDate = date; });

  1. I just reread the doc snippit that I posted -

in fact it does NOT say that onChange is triggered when you change the DAY, only month, year and time! so obviously that is MY bad… I made the assumption that the user event would be fired after ANY change was made. obviously that is NOT the case.

  1. the workaround/revision still does not do what I need because it is still triggered BEFORE the day is changed, thus there is NO CHANGE.

so then… it would appear that there is NO WAY to trigger a user event AFTER a DAY has been changed. is this correct? if so I simply can’t use this application. and as a programmer I find this a significant oversight.



I think, you need ‘onClick’ event, because ‘onChange’ uses the current date, like navigation event quicker to change years, months, time…
These 2 events are such the way they wrote, and this functional won’t correspond.

from what I can tell when it’s tested, onClick happens when you open the calendar, NOT when you change the date. I need it to happen when you change the day. i.e. when the user changes a day I need to refresh the price I charge them for their reservation. each date they can choose can potentially have a different price. using a dropdown to change the month or year and then trigger onChange is not helpful.

you know the day has changed because you put it into the form field. can’t you put the onChange event in there? that’s where it belongs. OR add a new event at that point.

Based on our previous example I made for you a new demo with the log of onClick.
See attaches

By the same principle you can establish loading/updating of yours Grids for a certain date
calendar_events.rar (34.6 KB)