Skip to main content

onEventSave

Description

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

onEventSave: (id: string, ev: object, original_ev: object) => void;

Parameters

  • id - (required) string - the event's id
  • ev - (required) object - an intermediate event's object that contains the lightbox's values.
  • is_new - (required) Date - returns 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

Returns

  • result - (boolean) - defines 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;
})

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
Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.