1

I have a parent window which is a Display page of a list item. This page comes as a result of some redirection with custom querystring parameters to it.

one of the querystring parameter is AutoRedirect=True and what i am doing in the code is if the value is True then open a ModalPopUp which will be reference to child list.

Now my issue is when i Save the item from ModalPopUp the popup closes and keeps coming again and again as a result of postback on the parent page. I want the popup to be opened only at first instance and during second instance i would like to notify user with some message.

I am doing this using JavaScript and i do not have permission to do any server side coding. Can anyone please help me to understand how can i pass some parameter from ModalPopUp to parent window which will help me in checking that one child item has already been saved.

$(document).ready(function() 
{
    if(GetUrlKeyValue('AutoRedirected')==='True')
    {
     flag =1;

        //Opens PopUp for adding child items
        OpenPopUp();
    }           
});

function OpenPopUp()
    {
        var URL = "https://somesite.something.com/sites/testSiteColl/Lists/Marcel%20%20Child%20List/NewForm.aspx?RootFolder=&IsDlg=1" ;

        var FinalURL = URL+ "&OppsID="+OppsID;

        NewItem2(event, FinalURL );
    }
  • Why not use SP.UI.ModalDialog? You can specify a callback function that can alert the user. You can also refresh the page, but if you have the modal appear on page load, then you might not want to use the modal's built-in refresh method, but simply set the window.location, and use a query string parameter so that the page will know if the modal needs to open on page load. – wjervis Aug 21 '14 at 14:05
1

If you can attach JS to the save action in your IFrame its quite easy.

//set this in your IFrame when your item was saved
var itemWasSaved = 0;
if(yourItemWasSaved){
   var itemWasSaved = 1;
}

//check if the item was saved via accessing the IFrame variable
var iFrameItemInfo = $('#youriframe').get(0).contentWindow.itemWasSaved;
0

Because you're working in an iframe, you'll have to call the parent document from within the frame.

Follow these instructions: https://stackoverflow.com/questions/4689145/pass-jquery-variables-between-iframe-and-parent

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.