Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

passing table values from child window to parent

Posted on 1998-05-07
2
Medium Priority
?
176 Views
Last Modified: 2012-06-21
While a user is filling in form info, I would like to display the selection choices for the text field
 in a secondary window. Then when the user 'click's on a value from the table of the secondary
window, the value is passed back to the parent window, and  copied into the parent form's
 input text field. I have read about passing values from one form to another,but need a
 detailed example of how this would apply from window to window. Does anyone know
how this could be done in javascript?  thanks
0
Comment
Question by:jkfox
[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
2 Comments
 
LVL 6

Accepted Solution

by:
Holger101497 earned 300 total points
ID: 1277541
Do you really mean two "windows"? you can not open "stay-on-top" windows from JavaScript, so your second window would hardly be visible... I suggest using a second "FRAME" at the top of the page...

anyway... for two windows, it would look like this:

<HTML>
<script>
function displayChoices(tf) {
  chWin=window.open('','choices','height=130,width=125,menubar=no,statusbar=no');
     // this opens a new window... assign a ref. to a frame if you decide to go with a frame
  with (chWin.document) {
    write("<HTML><HEAD><TITLE>Your choices</TITLE></HEAD>");
    write("<BODY>Your choices for "+tf.name+" are:<BR>");
    write("<form name=choiceform><SELECT SIZE=1 onchange='opener.document." +tf.form.name+"." +tf.name+".value= this.options[this.selectedIndex].text;'>");
    if (tf.name=="color") write("<option>yellow<option>red<option>blue<option>black");
    if (tf.name=="size") write("<option>small<option>medium<option>large");
    write("</select></form></BODY></HTML>");
    close();
  }
  chWin.focus(); // bring to front
}
</script>

<BODY>
  <FORM name=myform>
    <INPUT TYPE=text name=color length=10 onfocus="displayChoices(this)"><BR>
    <INPUT TYPE=size name=size length=10 onfocus="displayChoices(this)"><BR>
  </FORM>
</BODY>
</HTML>

note that "opener" refers to the window that opened the current window... writing this to the "new window", it refers to the "main window"
You might also need to insert a timer to check if the "new window" should get the focus, i.e. be sent to the front...

Good luck and let me know if everything works for you!
0
 

Author Comment

by:jkfox
ID: 1277542
This answer is a close resolution, however, I will need to open another .html in the window.open function call, this .html will use sql techniques to retreive data from the database and display the data choices within a table. Also, in the example provided above, the 'close();' statement is not really closing the new window. any other ideas?

thanks
jkfox

0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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…

636 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