I need to have 2 modal dialog popup on Sharepoint site opening, but a problem is that you can have only one opened at a time, and the last opened wins closing opened before. So I thought that I need to open the second Modal Dialog only after the first one is closed by a user. I thought of something like fireing a OnClose event, that would call the second window, but have no idea how to do it. Please advice how can this be done.

1 Answer 1


Assuming this is 2013 (since there is no version noted)... You can have a dialog box open from another dialog box. That automatically closes the first one (technically, what I believe that it does, actually, is call the application page in question from within the frame of the original modal dialog; this would explain why you don't get behaviors such as auto-postbacks on that transition).

If you really need to actually fire it on the closing of the first box, you should just be able to call it from your callback function. See the signature here:

SP.UI.ModalDialog.commonModalDialogOpen(url, options, callback, null);

The callback requires 2 arguments (I believe the SP-advised names for those are "result" and "value"), and you can use these to determine how the modal dialog was closed. I often use this callback to cause a postback but you could use it for anything JavaScript, really.

  • Thanks alot, SP.UI.ModalDialog.commonModalDialogOpen(url, options, callback, null); worked just perfect. BTW, it's SP 2010 Foundation.
    – Taras
    Apr 30, 2014 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.