Solved

Passing values from child to parent

Posted on 2004-04-13
6
1,233 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
Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Alert after MVC form submitted 1 41
Mobile apps - web/native or hybrid? 1 121
auto play video on web page 4 59
How to set up WAMP on a windows 8.1 IIS machine 14 48
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

752 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