Passing information between windows
Moderator: General Moderators
Passing information between windows
Is it possible to pass a variable from a popup window back to the window that popped it up? For instance: I want to be able to click on something in the popup and have it change the dropdown (select element) in the original window. Is this possible?
I'm pretty sure is has to be client-side. I don't have direct access to any files because I am working with MIVA merchant. I thought there was a wy to do something sorta like this, but I can't find info about it:
(This is the popup window)
(This is the popup window)
Code: Select all
mainWindowName.formname.formelement.value = "FOO";Code: Select all
opener.document...- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
This comes straight out of phpBB's user administration. I am sure there is some importance on form names and window names.
This page pops the window open when you click the 'Find a username' button...
This code allows you to select a user from a select list and it will send that information back to the calling page...
This page pops the window open when you click the 'Find a username' button...
Code: Select all
<form method="post" name="post" action="formaction.php">
Select a User<br />
<input type="text" class="post" name="username" maxlength="50" size="20" />
<input type="hidden" name="mode" value="edit" />
<input type="submit" name="submituser" value="Look up user" class="mainoption" />
<input type="submit" name="usersubmit" value="Find a username" class="liteoption" onClick="window.open('./../search.php', '_search', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" />Code: Select all
<script language="javascript" type="text/javascript">
<!--
function refresh_username(selected_username)
{
opener.document.forms['post'].username.value = selected_username;
opener.focus();
window.close();
}
//-->
</script>
<form method="post" name="search" action="search.php?mode=searchuser">
<select name="username_list">
<option value="me">me</option>
<option value="you">you</option>
</select>
<input type="submit" class="liteoption" onClick="refresh_username(this.form.username_list.options[this.form.username_list.selectedIndex].value);return false;" name="use" value="Select" />
<br /><br />
<a href="javascript:window.close();" class="genmed">Close Window</a>
</form>- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA