I wanted to stop users from booking things at the same time. If found this simple piece of code did the trick.
scheduler.attachEvent(‘onEventChanged’,function(id,data){
var evs = scheduler.getEvents(scheduler.getEventStartDate(id),scheduler.getEventEndDate(id));
if (evs.length > 1)
{alert(‘Sorry a booking already exists for this time.’);
scheduler.clearAll();
scheduler.load(‘XMLCal’);
return false;
}
Possibly it would be better to delete the new event and not to reload the scheduler:
scheduler.attachEvent(‘onEventChanged’,function(id,data){
var evs = scheduler.getEvents(scheduler.getEventStartDate(id),scheduler.getEventEndDate(id));
if (evs.length >1){
alert(‘Sorry a booking already exists for this time.’);
scheduler.deleteEvent(id);
}
})
Thanks Alexandra, that was a great help.
I had to add a flag to indicate this delete was only intended for UI, as I’ve built this to store the info in a Domino database, and it was trying to delete a document that didn’t exist without it.
Thanks again.