Page 1 of 1

parent child windows- losing value of window.opener

Posted: Wed Oct 21, 2009 12:56 pm
by kewpe20
Hello all,

I've been trying to a resolve an issue with a parent page not reloading after a child form is submitted.
The initial problem is that I immediately lose the value of window.opener on the call to the child window.. What am I doing wrong?

Here is my call to the child window in my php file:

<a href="notes.php" class="actiontiny" target="_blank" onclick="modalWin('3','4','add' ); return false;">Add Note</a>

Here is the Javascript for modalWin function:
The alert statement results in "undefined" when it should result in the name of the parent's php file name....right?

function modalWin(type, id, func) {
alert(window.opener);
if (window.showModalDialog) {
window.showModalDialog("notes.php?type="+type+"&id="+id+"&func="+func+"","Notes", "dialogWidth:600px;dialogHeight:510px");
} else {
window.open('notes.php?type='+type+'&id='+id+'&func='+func+'','Notes',
'height=510,width=600,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');
}
}

Re: parent child windows- losing value of window.opener

Posted: Mon Oct 26, 2009 9:00 am
by godwinsam
Hello,

Please use the following code,
window.close();
if (window.opener && !window.opener.closed) {
window.opener.location.reload();
}