stillhanginon
Programmer
Hi, I'm using the DHTML Calendar, version 1.0 and need to disable certain dates from being selected.
The documentation says, "You can disable individual dates by supplying a callback function which receives a JS date object and returns true if that date must be disabled, or false otherwise. You can write anything you want in the disabled() handler—just try to make it fast enough, as it will be called many times within milliseconds when the calendar is displayed. Here's an example, suppose you have in your database a list of dates that should be disabled, just convert them to numeric value and build up a hash table, then your disabled() handler can very conveniently return true for them:
I'm not sure where I would add this code. The files I have are calendar.js and calendar_function.js
I've tried adding it to the calendar_function.js file, but then the calendar just doesn't work. Is there a specific place the code has to be added? I know I'm missing something here and I hope someone can help me.
Please let me know if you need more info.
Thanks,
Jim
The documentation says, "You can disable individual dates by supplying a callback function which receives a JS date object and returns true if that date must be disabled, or false otherwise. You can write anything you want in the disabled() handler—just try to make it fast enough, as it will be called many times within milliseconds when the calendar is displayed. Here's an example, suppose you have in your database a list of dates that should be disabled, just convert them to numeric value and build up a hash table, then your disabled() handler can very conveniently return true for them:
Code:
var DISABLED_DATES = {
20090502: true,
20090505: true,
20090510: true,
20090511: true
};
Calendar.setup({
cont : "sample3",
disabled : function(date) {
date = Calendar.dateToInt(date);
return date in DISABLED_DATES;
}
});
I'm not sure where I would add this code. The files I have are calendar.js and calendar_function.js
I've tried adding it to the calendar_function.js file, but then the calendar just doesn't work. Is there a specific place the code has to be added? I know I'm missing something here and I hope someone can help me.
Please let me know if you need more info.
Thanks,
Jim