Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

info from a pop up to main page 1

Status
Not open for further replies.

milams

Programmer
May 28, 2004
32
US
I was wondering if anybody would be able to help me on this? Is there a way that you can take information from a pop up window(ie. A Hyperlink) and have it poulate a field in a form on the page where the pop up window came from. I hope that makes sense.
 
Yes.

In your popup window, if you're trying to populate the parent form with a button click event, try the following:

Code:
var the_val = document.pop_up_form_name.field_name.value;
window.opener.parent_form_name.field_name.value = the_val;

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Does the pop up window have to be a form? The pop up window is a search result created from a dynamic list querying a database in PHP.
 
Nope. It could have a link on it.

For example (not tested):

Code:
<script language="javascript">
<!--
function popParent(the_val) {
    window.opener.parent_form_name.field_name.value = the_val;
}
-->
</script>

...

<?
echo '<a href="#" onclick="popParent(\'' . $val . '\')">' . $val . '</a>';
?>

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
That did the trick. Thank you very much. You all were a great help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top