Event drag/resize validation

Hi,

I need to validate the changes made by dragging or resizing the events on a scheduler.

When I edit the event with a custom lightbox it makes validations and shows a bootstrap modal that user can interact with, deciding to proceed saving the event or not (they have 3 options).

With dragging/resizing I don’t know how to do the same. If I validate the event with the onBeforeEventChanged I can’t wait the user to view a modal and press a button, isn’t it? I can do it with a JS confirm() but it doesn’t solve the problem because I need more than yes/not buttons/actions.

Any idea?

Thx

Hello,

Yes, it’s correct. There is some ways to handle this. You can catch onBeforeEventChanged event, copy a an unchanged event and then show the popup, and return ‘true’ from onBeforeEventChanged (let scheduler apply the changes)
If user clicks ‘cancel’ - you update an event with the saved values of an unchanged instance, i.e. rollback changes. Note that you’ll probably need to suppress sending data to the server by the dataprocessor that will normally happen after returning true from onBeforeEventChange

Or you can do from the opposite (it won’t require handling the dataprocessor, but may look weirdly for the user) - make a copy of a changed instance and cancel the operation from onBeforeEventChanged. If user confirms it - you update the event with new values, check the sample
docs.dhtmlx.com/scheduler/snippet/6fba3588

@dimass I have the exact same problem here

@Aliaksandr
your second solution is not working for me. I can’t rely on an alert message, and even if i could is not working for me.

I was wondering how can i do you first implementation, how can copy original event object to the , use showlightbox function to display my custom bootstrap modal, and then on click cancel “submit” the form with originalEvent values putting the event back to its original state.

Sorry for the noobish question, but my js skills don’t seem enough to deal with this scheduler beast.
Thanks in advance