Solved

Passing values from child to parent

Posted on 2004-04-13
6
1,234 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 50 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

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

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

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

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…

617 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