Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Refresh Parent window after opening a child window and submitting

Posted on 2003-10-27
Medium Priority
Last Modified: 2012-06-27
Hello gurus,

The situation is that I have a list page (parent page) with a list of items that the user wants to print. Once he selects all the items and clicks 'Print' on the list page, I open a child window, submit the request to the backend, change the modified timestamp for all the selected records in the database and get back the response and show it to the user. After that I want to refresh the parent window with the last modified date for all the selected items....

The problem is that the backend process might take any amount of time and I have to refresh the parent page only when I get all the data back....Can anyone suggest how I can achieve this ? I have tried putting a wait time after submitting but that doesnt seem to work...Here is the relevant code...Please help...

  if (IE5)
    _wPrint = window.open('', PRINT_POPUP_NAME, 'scrollbars=yes,height='+PRINT_POPUP_HEIGHT+',width='+PRINT_POPUP_WIDTH+',left=100,top=100,resizable=yes,status=no,toolbar=no,directories=no,menubar=no', false);
    _wPrint = window.open('', PRINT_POPUP_NAME, 'scrollbars=yes,height='+PRINT_POPUP_HEIGHT+',width='+PRINT_POPUP_WIDTH+',screenX=100,screenY=100,resizable=yes,status=no,toolbar=no,directories=no,menubar=no', false);
  _wPrint.document.write('<html><title>Items</title><P valign="middle" align="center" style="font-family: Arial"><B>Please wait while the page is formatted for printing...</B></P></html>');
  theForm.target = PRINT_POPUP_NAME;
  theForm.method = 'post';

function printDetails() {
  var f = document.pilistform;
  var numberChecked = 0;
  if (f.detaildata) {
      var itemInfo = "";
            for (var i=0; i<detailData.length; i++) {
                  if(detailData[i].checked) {
                        itemInfo += detailData[i].value + ';';
    if (itemInfo.length > 0) {
      f..value = itemInfo.substring(0, itemInfo.length - 1);
      callItemPDFPrint(f, "printitemrequest", "viewprintitemrequest");
    alert("Select One Item First");

function reload_list() {
      //Logic to reload the parent

Question by:prashanth9
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 25

Expert Comment

ID: 9630206
in popup in body onload call function from parent window
<body onload="opener.reload_list();">

or refresh parent window
<body onload="opener.reload();">
LVL 10

Expert Comment

ID: 9630234
The normal way of doing would be that the print output caries a function with it to refresh the parent window.

Are you able to extend the print output with a function for parent window refresh or is this forbidden for you?

If it is forbidden or for any other reason not possible to change the form submit response, then is the only option you have to poll the wait window in a timer interwal and observe wether some detail has changed, for example a global variable in that popup window.

Which method would you prefer: popup polling or response modify?

LVL 15

Expert Comment

ID: 9630429
How about placing a target in you form and letting the server generate the new page

<form href="filetogenerateupdatedlist.php" target="nameofparetwindow">

that way the server regulates the update to happen only when the form data have been handeled.

You can give the parentpage (or any window) a name with javascript:
     window.name = ""nameofparetwindow";

regards JakobA
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 9632984
I have tried putting in a wait method in my parent window and depending on the number of items that get selected, I used to wait for certain number of seconds before refreshing the parent page but this proved to be unreliable....My items sometimes take very less time and sometimes very long depending on the network and database connections...I didnt understand your questions fully but if you can see the code, I call the child window from my parent window and try to refresh the parent window with logic written in it. I only need logic to make sure that I wait for as long as the child window is done processing before the parent gets refreshed...

Jakoba and Devic,

I will try implementing each of the solutions you have suggested today and see which one works. I had one question however.

How do I make sure that the parent window refreshes only after the child window gets all the content stream from the backend ? The child window might take anywhere between 1 sec and 20 seconds to get the data...I want to refresh my parent window ONLY AFTER all the processing in the child window is done.

Can anyone shed some light on this and let me know how to make sure this happens ?

LVL 25

Expert Comment

ID: 9633032

ONLY AFTER all the processing in the window is done, come EVENT ONLOAD
LVL 16

Expert Comment

ID: 10346038
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ with points refunded

Please leave any comments here within the next four days.

EE Cleanup Volunteer

Author Comment

ID: 10348245
I cannot accept any of the above answers as none of them worked for me. I implemented this logic using a different technique where I catch a Javascript Exception. Refer to this link to see how I solved the same problem :


So, no points to anyone here.

Accepted Solution

Computer101 earned 0 total points
ID: 10377130
PAQed, with points refunded (125)

E-E Admin

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question