Triggering lightbox save and hooking lightbox close event

Hello,

I need to programmatically trigger the save button event in the lightbox and would like to trigger a JavaScript event after the lightbox closes and the save event has been saved. I could trigger the save button using jQuery if necessary but I need to be able to redirect the browser to another URL after the save event is completed. Is there a way to do this?

Thanks in advance,
Chris

Hello,

scheduler.save_lightbox();

Best regards,
Ilya

Thanks Ilya, that solved part of my problem. Here is the challenge I have now:

When the user clicks a particular link in a custom section of the lightbox, I need to redirect the user to another page using the event ID in the database. The event must be saved (if it’s new or changed) before the redirect happens.

If the event is new and hasn’t been saved, or if it has been saved but has changed, I need to get the event to save first, then do a redirect to the other page. If the event has not changed, I can just do the redirect immediately.

I haven’t found a way to tell if the event values in the lightbox have changed. I do know I can use the onEventIdChange event to get the new event ID when the event is first saved, but this doesn’t help if the event has already been saved and only had one of the values change.

Any ideas on how to do this?

Thanks,
Chris

Scheduler itself doesn’t track is values were changed or not. It attempts to save the data on each “save” click.

You can
a) set handler on onBeforeLightbox and save event before editing ( you need to copy all attributes of event object, not the object itself ! )
b) before calling save_ligthbox, call
var obj = scheduler._lightbox_out({ id: scheduler.getStat().lightbox_id})
it will return event object with new set of properties
c) compare properties of new object with one, saved previously, and do action based on results