Hi there,
I’m having a problem and it looks like this isn’t covered by the api, which seems crazy, unless I’m missing something.
I’m trying to validate the dropdown menus to enforce the user to make a selection. If there is no selection, the user should be prompted to make the selection and the process halts there. I’m able to successfully override an event deletion with a javascript confirm (the lighbox form stays on the page) so why am I unable to prevent the event from being written into the scheduler when I’m returning false to the onEventAdded event?
From the apis it seems that I can also override onEventSaved event for a pre-existing event. Why would I be able to override this and the deletion event but not the addition event? Help please, as I’m tearing my hair out.
Cheers,
Lance
onEventAdded is the information event, it occurs when new event already added to the scheduler ( it is written in the inner structures and DB saving operation already in progress ) - it is too late for the operation prevention. ( same for onEventChanged and onEventDeleted )
If you need to block operation - you need to use the early events such as
onBeforeEventChanged - after dnd manipulation, before event saving
onBeforeEventDelete - delete command issued, but not complete yet
onEventSave - saving command issues, but not processed yet
Hi,
Thanks for your reply, but it looks like my fears are confirmed. Is there no ‘onBeforeEventAdded’ or equivalent?
It seems I can block a drag-drop operation, a delete, or a lightbox save to amend an existing event - but there’s no way to block when adding a new event? How am I supposed to validate the new event? This is when this functionality is needed most.
Is there really no way to block a new event?
Cheers,
Lance
Thanks for your reply, but it looks like my fears are confirmed. Is there no ‘onBeforeEventAdded’ or equivalent?
There is no such event
How am I supposed to validate the new event?
If you will set
scheduler.config.details_on_create = true;
then after event creation (and before event saving! and onEventAdded) lightbox form will shown, and the only way to save new event will be through clicking on onEventSave method, which you can use for validation ( returning false will block new event saving )
Also, onBeforeEventChanged is called even before lightbox opening ( this event will be called for both change and add operations ) - but in this moment user was not able to enter any details except of time, so it seems to early for any validation.
Okay I think I can now get this working. Many thanks!
Cheers,
Lance