/    Sign up×
Community /Pin to ProfileBookmark

Javascript to send form results to opener

I want to send the results of a pop-up form to a specific frame in the window that opened the form. The pages are coded using document.form.target=”content” where content is the name of the frame in the main window. This doesn’t work anymore because users want to have multiple sessions of the same site opened, and sometimes the form data is being sent to the wrong main window.

I figured that using window.opener could solve this problem, but I can’t get any code to work. I tried:

document.form.target=window.opener.content;
document.form.target=window.opener.parent.content;
document.form.target=window.opener;

And several others. These only send the form results to a new window.

Any suggestions?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@KorAug 01.2005 — the reference of an object (a document's object) starting from pop-up to a frame in opener should be something like

window.opener.top.frames['framename'].document.[i]object[/i]

or better

window.opener.window.top.frames['framename'].document.[i]object[/i]
Copy linkTweet thisAlerts:
@rpp124authorAug 01.2005 — Thanks for the reply. I tried window.opener.top.frames['body'].frames['content'] (it is a nested frameset where body is the whole page and content is a frame within body). I also tried setting the target to a few other things. When I use window.opener.window.parent.body.content, nothing happens when I click submit, but when i use anything else, a new page opens up with the desired URL.

Any more suggestions on how to set the target to that specific frame on the page?
×

Success!

Help @rpp124 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...