Solved

Passing values from child to parent

Posted on 2004-04-13
6
1,225 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
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Uploading files to the web server has become common part of almost any kind of web application. People use different technologies to solve this, but regardless of the technology used, it is always useful to have some kind of progress indicator shown…
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now