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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parent Child Reunion in Passing Value

Status
Not open for further replies.

iggitme

IS-IT--Management
Sep 13, 2006
47
US
Hi Gang!
This is my situation.
I have a form on a parent window that has a button to select a member to send a message to.
That button opens an extensive utility to search members in all sorts of ways and each member found results in a listing and a tiny form button. I need to pass the value in a hidden field of that tiny form button back to the parent window's form and it needs to show up in a visible text box and a hidden form field (the text box is just for show).

I'm generating the popup page with a perl script so this may look a tad strange, escapes are perl necessity: A$resp is a form name that increments from A1 to A[a whole bunch of numbers]

---------------------------------------------------
Code:
<script langauge=\"javascript\">
function post_value$resp(){
opener.document.form.to.value = document.A$resp.send.value\;
self.close()\;
}
</script>

<form name=A$resp><input type=hidden name=send value=\"$sendto\"><input type=submit name=to value=\"<\" style=btn style="height:17px;width:17px;font-family:helvetica;font-size:10px;color:#000000" onclick="post_value$resp();">
---------------------------------------------------

I've tried many variations of this. Nothing works. Nothing sends the data from the 'send' field in the popup form to the 'to' field in the parent window's form.

I'm asking if anyone has a solution for this and I thank you very much for your time and effort.
 
[1] This,though, will not break in normal circumstances.
><script langauge=\"javascript\">
[tt]<script lang[red]ua[/red]ge=\"javascript\">[/tt]

[2] With the form named "form" is not very good and can be confusing and is in the avoid-list.

[3] However, this will break
opener.document.form.to.value = document.A$resp.send.value\;
_if_ there are _more_ than one form named "form" in the parent.
[3.1] You can test it in case you really have.
[tt]opener.document.form[blue]s[0][/blue].to.value = document.A$resp.send.value\;[/tt]
This will send to the first form named "form".
[3.2] Make sure this is not happening.
 
Thank you. Yes there are other forms in the parent. To solve this I changed the form name to 'compose' in the parent and still no passed result. Also repaired the typo in <script ... But... still nothing...
 
[1]
>I changed the form name to 'compose' in the parent
Okay, but if you still have multiple form with the name "compose", it still breaks. You have to designate that particular form named "composed".
[tt] opener.document.forms["compose"][idx].to.value = document.A$resp.send.value\; //some given idx integer.[/tt]
Formally, if there are only one form named "compose", this show already work (even it is named "form", it is still fine.)
[tt] opener.document.compose.to.value = document.A$resp.send.value\;[/tt]

[2] Use view-source to look at the source see if perl generated the script for the popup as expected. You should discover something wrong there.
 
Thank you for your help. I tossed the concept and now have it working with a simple page reload and it seems to be better this way anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top