1

I have the next script on my page
Parent

function triggerModal(b,a)
{
    // if the url contains mysite - open it in showModalDialog 
    if (a.toLowerCase().search("person.aspx")>0 || a.toLowerCase().search("organizationview.aspx")>0)
    {
        ExecuteOrDelayUntilScriptLoaded(function () {
            var options = {
                url: a,
                tite: 'Mi Ficha',
                autoSize: true,
                allowMaximize: false,
                showClose: true,
                dialogReturnValueCallback: myDialogCallback
            };
            SP.UI.ModalDialog.showModalDialog(options);
        }, 'sp.js');
    }else{
        a:;STSNavigate(a)
    }
}
//THIS IS EXECUTED ONLY WHEN I CLOSE THE MODAL, NEVER WHEN I SEND THE OK
function myDialogCallback(target, strReturnValue) 
{
    if (target == SP.UI.DialogResult.OK) // Perform action on Ok.
    {
        triggerModal(null, "http://"+strReturnValue);
    }
}

Child

$(function() {
    $("div.s4-sn div.menu-horizontal ul li a").click(function(event) {
        SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, "www.google.cl");
        return;
    });
});

This works perfectly on IE, but doesnt not work on Chrome. The script execute on Chrome but does not trigger the commonModalDialogClose.

Can somebody tell my what I'm doing wrong?

4
  • Is there any "ExecuteOrDelayUntilScriptLoaded" in your code elsewhere?
    – 404
    Commented Feb 25, 2015 at 18:57
  • nop, i just put one few minutes ago, after the post :( I've changed the code leaving only the commonModalDialogClose function and still nothing. I'll update the post with all the code
    – Marco
    Commented Feb 25, 2015 at 19:05
  • To be sure I understand, is the Child code in your post sitting on a page that is being displayed in a modal dialog?
    – Thriggle
    Commented Feb 25, 2015 at 23:05
  • Yep, The Child is the code that is in the modal dialog, I am overwritting a click event of a link tag to close the modal dialog with an OK result. The Code execute fine, but the commonModalDialogClose is not firing, the dialog remains open.
    – Marco
    Commented Feb 26, 2015 at 23:48

0

Your Answer

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

Browse other questions tagged or ask your own question.