Solved

Write into a textbox on a child window from main window

Posted on 2001-06-26
5
207 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
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

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.

Join & Write a Comment

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

746 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

11 Experts available now in Live!

Get 1:1 Help Now