0

I have a SP UIModal Pop-Up, in which I want show Alert to user when click on [X]. How can i do this in SPD 2013

2

use option property of ModalDialog dialogReturnValueCallback

var options = {
    url: "/_layouts/myPage.aspx" ,
    dialogReturnValueCallback: function (dialogResult,returnValue )
    {
       if (dialogResult == SP.UI.DialogResult.cancel)//when user click on [X]
           alert ('popup canceled')
    }
};

SP.UI.ModalDialog.showModalDialog(options);
1

This code work for me :

function fAddOnCloseHandler()
{
    var oCloseButton = $("a[id^='DlgClose']");

    $clearHandlers(oCloseButton.get(0));

    $(oCloseButton).on("click", function (event) { fyourFun(event)} );
}   

_spBodyOnLoadFunctionNames.push( ExecuteOrDelayUntilScriptLoaded(fAddOnCloseHandler, "SP.js") );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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