Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1239
  • Last Modified:

Passing values from child to parent

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
dlzone
Asked:
dlzone
1 Solution
 
dlzoneAuthor Commented:
On a side note, is there a command in javascript to open a word document?
0
 
DarixCommented:
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
 
suji17Commented:
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
Technology Partners: 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!

 
dlzoneAuthor Commented:
Thanks for the quick response.
Any idea on the word document question?
0
 
waikikiguyCommented:
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
 
waikikiguyCommented:
I would to store the return values in comma delimited format
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now