Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a modal dialog that I commit by calling window.frameElement.commitPopup(), and this is great because it refreshes the parent window.

However I would also like to display a notification on the parent window afterwards using SP.UI.Notify.addNotification() (to show a success message), but because the parent window refreshes, there is no time to show the notification.

I can think of some ways using cookies or client storage, but I wondered if there was a different native SharePoint way to go about this?

-Adam

share|improve this question
add comment

3 Answers

you can use SP.UI.ModalDialog and create a custom function when dialog is closed as it is shown here: Using SP.UI.ModalDialog in SharePoint 2010 | Jon Dack http://www.jondack.com/index.php/2011/01/24/using-sp-ui-modaldialog-in-sharepoint-2010/

hope it helps

share|improve this answer
    
Yes, but that will only work if you do not refresh the parent page. Once you refresh the parent page, your notification is gone, and no way to load it on the newly refreshed parent page. –  Adam Toth Jan 14 '13 at 22:10
add comment

Try this code:

function showDialog(){
 SP.UI.ModalDialog.showModalDialog({
    url: urlToOpen,
    title: "title",
    allowMaximize: true,
    showClose: true,
    width: 800,
    height: 600,
    dialogReturnValueCallback: silentCallback
    });
}
function silentCallback(dialogResult, returnValue) {
    switch (dialogResult) {
        case SP.UI.DialogResult.cancel:
            break;
        default:
            SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
            break;
    }
}
share|improve this answer
add comment

If you absolutely want to refresh the page and notify the user, you could store the notification as a cookie or in the localStorage and then, when the page is refreshed, get this notification text and show it to your user. I would do it so.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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