Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Passing values from child to parent

Posted on 2004-04-13
6
Medium Priority
?
1,235 Views
Last Modified: 2010-05-18
Hello,
I have a simple form with a textarea and a button. When the button is pressed, a window pops up that contains an input box and an another textarea. When the button inside the pop up window is pressed, the value from the child textarea is passed back to the parent textarea.

The question is, how do I pass the value in the child input box and just store it in a variable inside the parent window?
0
Comment
Question by:dlzone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Author Comment

by:dlzone
ID: 10811232
On a side note, is there a command in javascript to open a word document?
0
 
LVL 1

Expert Comment

by:Darix
ID: 10811600
you can write in child window button declaration: onclick="document.parent.form_name.textarea_name.value = document.child_form_name.child_textarea_name.value" is that i understood?
0
 
LVL 1

Accepted Solution

by:
suji17 earned 200 total points
ID: 10811628
parent window code(i.e main.html)

<html>

<head>
</head>
<body>
<script language="javascript">
var ls_value=0
function call()
      {
            open("childwnd.html")
      }
</script>
<textarea name ="T1" rows="2" cols="22"></textarea>
<p><input type="button" value="Pop" name="B1" onclick ="call()"></p>
<p><input type="button" value="Get Value" name="B2" onclick ="alert(ls_value)"></p>
</body>
</html>

child window code (i.e childwnd)
<html>

<head>
</head>

<body >
<script language="javascript">
function call_return()
      {
            var ls_text = document.frm_child.text1.value
            ls_text = document.frm_child.T1.value
            self.opener.ls_value = ls_text
            self.close()
      }
</script>
<form name ="frm_child">
  <p><input type="text" name="T1" size="20">
      </p>
  <p>
  <textarea name ="text1" rows="2" cols="22"></textarea>
      </p>
  <p><input type="Back" value="Button" name="B1" onclick ="call_return()"></p>
</body>
</form>
</html>


bye suji

0
Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

 

Author Comment

by:dlzone
ID: 10811722
Thanks for the quick response.
Any idea on the word document question?
0
 

Expert Comment

by:waikikiguy
ID: 24835692
hi guys,
is there any way i can pass the multiple-selected checbox value from child to parent?

i was thinking of an array to pass multiple values from child and iterate the return values in parent (and store it in the text box).
Appreciate any valueable inputs.

0
 

Expert Comment

by:waikikiguy
ID: 24835776
I would to store the return values in comma delimited format
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question