onEventSave

fires when the user clicks on the 'save' button in the lightbox (edit form)

boolean onEventSave(string id,object ev,Date is_new);
idstringthe event's id
evobjectan intermediate event's object that contains the lightbox's values.
is_newDatereturns the date of event's creation (i.e. the current date), if the user is saving a new event. null - if the event to save already exists
booleandefines whether the default action of the event will be triggered (true) or canceled (false)

Example

scheduler.attachEvent("onEventSave",function(id,ev,is_new){
    if (!ev.text) {
        alert("Text must not be empty");
        return false;
    }
    if (!ev.text.length<20) {
        alert("Text too small");
        return false;
    }
    return true;
})

Related samples

Details

The event is blockable and can be used for validation. Return false to cancel the default processing.

Please, note:

  • When the event fires - values set in the lightbox haven't beed applied to the original event yet and scheduler.getEvent(id) will return you an unmodified instance.
  • The 'ev' object will contain just values that are set by the lightbox, i.e. if the lightbox has just 1 input - the 'ev' object will have only 1 property defined
Back to top