Forum Moderators: open
I have looked all over the internet for a solution to this, but I can't seem to find it, even though there seems to be a bunch of documents talking about it.
My script has a link that opens a new window that has a script with a form. When this form is submitted I want the action to happen in the original window.
According to the websites I have been visiting adding: onclick="this.form.target=window.opener;return true;" to the submit button should take care of this. However when I click the submit button, it opens a new window, and executes the action there instead.
I have tried with both FireFox and Internet Explorer 7. Any ideas why this doesn't work?
Thanks for all the help.
In my popup script I have links on all the dates that are laid out like this: <a href="javascript:window.opener.inputFieldName.value='yyyy-mm-dd';"> but I get an error saying that "window.opener.inputFieldName is null or not an object" in IE7 and "window.opener.inputFieldName has no property" in Firefox 1.5.
Anyone know why the window.opener doesn't seem to work as it should?
You could try something like
window.opener.name="opener728";
form.target="opener728";
however, I suspect the window.name property is read-only.
Alternatively, if you are certain that the opener already has a name then this might work
form.target=window.opener.name;
It's also possible that browsers assign unique names to otherwise unnamed windows, so the above would always work - I've never checked this.
Kaled.