Solved

Write into a textbox on a child window from main window

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

943 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

10 Experts available now in Live!

Get 1:1 Help Now