Solved

Write into a textbox on a child window from main window

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

776 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