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

Write child value to parent 1

Status
Not open for further replies.

mamabird

Programmer
Dec 19, 2006
15
US
I have a parent form that opens a child form so users can pick some values. When they submit the child form the values correctly populate the parent's input fields.

However, I don't want them to be fields on the parent, just text written to the page. It works when I have <input type="text"> (it will update the value). So I tried making them type="hidden" and using <script type="text/javascript">document.write(hidden form field.value);</script> but nothing happens when I submit the child form. I do NOT want to refresh the parent page.

Is there another approach to this?

Thank you!
 
Yes. Instead of setting a field's value on the parent page (presumably you are already familiar with the concept of "opener" to be able to do this), you could have a span, div or p element (for example) on the parent page:

Code:
<div id="someId01"></div>

and then write to it from the popup window with:

Code:
window.opener.document.getElementById('someId01').innerHTML = 'Some stuff here!';

Hope this helps,
Dan




Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
SWEET! That is just what I was looking for and it works great. Thanks Dan!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top