Close popup and reload parent

I have pop-up window with a form. It’s a simple php/pear Quickform and Dataobjects which I use to insert/update. The form posts back onto itself and if validated inserts/updates database.

I would then like to automatically close the popup and reload the parent (agenda) page to reflect change.

At present I use this, which requires that the user must click a button

onClick=“opener.window.location.reload(false); window.close();”

I have tried to use header("Location: "), but it does not seem to like javascript??
thanks

ger

Instead of having a header() function, try to print the javascript to the screen like this:


echo('<script language="Javascript">opener.window.location.reload(false); window.close();</script>');

I believe you want:

onClick=“window.opener.location.reload(true); window.close();”

You want to change it to true, because I’m assuming your parent window contents are dynamic and will change based on the users successful form submission. Using “true” should pull a fresh copy from the server.

Oh, and the reason its probably not working at all is because you want “window.opener” and not “opener.window”.

thanks,

just what I wanted.

ger

Is it also possible to only reload the ‘opener’ when the pop-up is closed but not on the unload();
I tought about an evenListner in the ‘opener’ that checks if the popup still exists.
Is this possible?

Hi there,

I try to do just the same thing. Difference here is that my button is an image and, it’s located on a page with frames.

I allready used the same code as mentioned here in a pop-up without the frames and it works well. So I really think the fact that there are frames in the pop-up causes the problem.

I call the pop-up in the parent window with a link (moreinfo_frame.php) that page is divided in 2 frames (navigate.php and moreinfo.php) the button that acts as window closer is located in navigate.php

but when I click it now nothing happens (when I choose to open in a new window he just reloads the navigation.php in an new window.

Can anyone help me? I’m not really an expert in javascript.

greetz,
Koen

nevermind I found the solution in another post

something like parent.close();

thx anyway!

greetz and best wishes for 2006

Koen