Solved

Write into a textbox on a child window from main window

Posted on 2001-06-26
5
212 Views
Last Modified: 2012-06-27
I have 2 forms.  The main and child window.  When i click on a button to open the child window, I would like to write a value from a textbox on the main window into a textbox on the child window.  I can write the value into the form but not the textbox.  Any suggestions???  Thanks in advance.

main form:
function OpenChild()
{    
newWindow = window.open('ChildWindow.cfm','myWindow','resizable=no,width=160,height=200');
newWindow.document.write(document.MainForm.strRegion.value)

I tried but did not work:
newWindow.document.ChildForm.ChildRegion = document.MainForm.strRegion.value
}

<input type="text" name="strRegion" onclick="javascript:OpenChild()" value="" size="25">


Child form:
<form name="ChildForm">
<input type="text" name="ChildRegion" value="">
</form>
0
Comment
Question by:tb20
[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
5 Comments
 
LVL 9

Accepted Solution

by:
nimaig earned 50 total points
ID: 6227504
try this:
Call a method in onload event of the child window.

eg.

<script language="javascript">
<!--
     function populateText(){
          if(opener){
               if(!opener.closed){
                    document.forms[0].txtChild.value = opener.document.forms[0].txtParent.value;
               }
          }
     }
//-->
</script>
<body onLoad="populateText()">
0
 
LVL 8

Expert Comment

by:bebonham
ID: 6227574
<SCRIPT>
function OpenChild()
{    
newWindow = window.open('child.htm','myWindow','resizable=no,width=160,height=200');
newWindow.document.ChildForm.ChildRegion.value = document.MainForm.strRegion.value
}
</SCRIPT>
<FORM NAME="MainForm">
<input type="text" name="strRegion" onchange="javascript:OpenChild()" value="" size="25">

</FORM>
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7811207
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
   In the absence of responses, I may recommend DELETE unless it is clear
   to me that it has value as a PAQ.  Silence = you don't care
</note>

Cd&
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7910137
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
points to nimaig

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7957935
Comment from expert accepted a answer

Computer101
E-E Admin
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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

623 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