H
humbads
I am trying to get a popup window to work for editing notes in my
application. Here's how I implemented it:
The original frame is called ORIGINALFRAME and contains a link like
this:
<a href="javascript:launchwin();">Edit Note</a>
function launchwin() {
// ... custom stuff
newNoteWindow = window.open(strURL,'NoteWindow',strOptions);
if(newNoteWindow.opener == null) {
newNoteWindow.opener = self;
}
if (window.focus) {
newNoteWindow.focus();
}
}
In the resulting pop-up window, I have a POST form whose onSubmit
handler contains these lines:
document.forms[0].target=window.opener.name; // becomes ORIGINALFRAME
document.forms[0].submit();
window.close();
I am passing the URL of the ORIGINALFRAME as a query string parameter
to the pop-up window. In the page that handles the form submission, it
reads this parameter and redirects to it after processing the form.
This way, the original frame appears to reload, and it only reloads
after the form is completely processed.
The implementation doesn't work in either IE or Firefox when there is
more than one original frame with the same name in multiple windows.
In Firefox, the post is directed to the first original frame, while in
IE, it doesn't seem to do anything.
The POST form is in the pop-up window. Does anyone know how to set its
target to the opener, reliably?
application. Here's how I implemented it:
The original frame is called ORIGINALFRAME and contains a link like
this:
<a href="javascript:launchwin();">Edit Note</a>
function launchwin() {
// ... custom stuff
newNoteWindow = window.open(strURL,'NoteWindow',strOptions);
if(newNoteWindow.opener == null) {
newNoteWindow.opener = self;
}
if (window.focus) {
newNoteWindow.focus();
}
}
In the resulting pop-up window, I have a POST form whose onSubmit
handler contains these lines:
document.forms[0].target=window.opener.name; // becomes ORIGINALFRAME
document.forms[0].submit();
window.close();
I am passing the URL of the ORIGINALFRAME as a query string parameter
to the pop-up window. In the page that handles the form submission, it
reads this parameter and redirects to it after processing the form.
This way, the original frame appears to reload, and it only reloads
after the form is completely processed.
The implementation doesn't work in either IE or Firefox when there is
more than one original frame with the same name in multiple windows.
In Firefox, the post is directed to the first original frame, while in
IE, it doesn't seem to do anything.
The POST form is in the pop-up window. Does anyone know how to set its
target to the opener, reliably?