Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Write into a textbox on a child window from main window

Posted on 2001-06-26
5
Medium Priority
?
215 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 200 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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

885 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