View Full Version : Submit form to opener window from a popup window
08-05-2002, 09:42 PM
Is it possible to submit a form from a popup window to the opener window?
Here is what I'm trying to do:
I have opened a popup window from my main window.
I have a form in the popup window.
I want to submit the form to the main window and close the popup window. Help me!
08-05-2002, 09:54 PM
Do you just want to pass the values from the pop-up to the main window? Or do you really want to post it to another page in the parent window?
opener.dcoument.formName.FormField.value = docuemnt.childForm.childField.value
An example of this can be seen in this thread.
08-05-2002, 10:17 PM
Thanks for the quick response.
I really want to post it to another page in the parent window?
Is this possible?
08-05-2002, 10:40 PM
Frm.target = top.opener.location.href;
<form onSubmit="return setTarget(this)" method="post" action="whatever.php" target="">
08-05-2002, 10:43 PM
Can a target be an object reference?
08-05-2002, 10:47 PM
Sorry, I edited it a bit after posting...should be accurate now...(in other words, NO, not that I know of)
08-05-2002, 11:10 PM
I have tried that but it submitting to a new window.
Here is an alternative to this problem:
In the parent window page:
Create hidden fields to hold popup form fields.
In popup window page:
Move all the form field values to the opener form hidden fields.
Set the action of opener.
Submit the opener form.
Close the popup window.
Any other solutions?
Thanks for the help.
08-05-2002, 11:15 PM
In the pop-up:
<form action="some_url" target="mainWin">
In the main (opener) window:
self.name = 'mainWin';
In the file referenced as "some_url" above:
var child = open('',name);
if (child && !child.closed) child.close();
Use the name you opened the pop-up with in place of name, in quotes. Might work...
08-05-2002, 11:27 PM
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.