Use jQuery UI Dialog in lightbox save

Hi,

I’ve modified the “onBeforeEventChanged” and “onEventSave” event with inserting a “confirm box” function in javascript that I use to ask a question to users.
This is the code :

  scheduler.attachEvent("onEventSave",function(id,data)
  {
    ... some code ...
    var r=confirm("Question ?");
    if (r==true)
    {
      ... some code ...
      return true;
    }
    else
      return false;  
    return true;
  });

Now I need to make stylish this component and I’ve seen that the jquery UI dialog is the most usable.
My problem is that when I open the new dialog box inside the lightbox save function, this not wait for the user response and the function is executed right to the end (the event is correctly saved).
How can I stop the save function until the users interact with the dialog box ?
Any help is appreciate.
Thanks,
Lorenzo

Hi,
the possible solution is to override scheduler.save_lightbox function, to make it able to wait for callback from the dialog , and to show the dialog from the save_lightbox function instead of onEventSave event.
something like following:var oldSave = scheduler.save_lightbox; scheduler.save_lightbox = function(){ //show the dialog $("#dialog" ).dialog({ ... buttons: { //hide the dialog and trigger default behavior "Ok": function() { $( this ).dialog( "close" ); oldSave.apply(scheduler, []);//save changes }, "Cancel": function() { $( this ).dialog( "close" ); scheduler.cancel_lightbox();//just close the lightbox } } }); };Please note that this is not working code, I haven’t tested it. It’s here just to clarify the point

Basically - you can’t.
Native javascript alert ,confirm and prompt functions are only exceptions, which can block js execution process. Any third party library will not be able to block script execution.