View Full Version : sending Child values back to parent

k Rajesh
06-12-2003, 04:17 PM
before putting this simple question I looked into existing questions, but unfortunately I couldn't find the most related.

I have jsp A having txt box and search button associated to it after click it opens child window with list of peoples and id (UID-First and Last name)

What I need is, once you select any uid, child window should be closed and value of UID (only) should be passed back to parent window (I have txtbox in parent window for it)

thanks in advance

Mr J
06-12-2003, 04:44 PM
Experiment with the following

In the opener

<P><form name="f1">
<P><input type="text" name="t1" value="Receiving Textbox" size="30" <a href="#null" onclick="popit=open('opened1.htm','pop','top=280,left=390,width=300,height=200');popit.focus()">Open Popup</a>
<P><div id="oDIV">Text From Popup</div>


In the Popup

<script language="javascript">
function transfer(str){
if (opener && !opener.closed){

<form name="f1">
<a href="javascript:transfer('This is from the popup link 1')"> Link 1</a>
<P> <button onclick="opener.oDIV.innerHTML='<font color=red> Sample Text From Popup</font>'">Enter Div Text</button>
<P> <input type="text" name="t1" value="Type Some Text In Here"> <input type="button" value="Send" onclick="transfer(document.f1.t1.value)"> <BR>
<P> <button onclick="window.close()"> Done</button>

06-12-2003, 04:45 PM
To access a popup window's opener document, just use


And from there, you can access he full DOM for the parent window. So, if you have a form "myForm" with an element "myElement"

window.opener.document.myForm.myElement.value = someValue;

k Rajesh
06-12-2003, 05:08 PM
Thank you for quick response

here is my code.

main page

<FORM name="MainPage" method="POST" onsubmit= "return validateData()" action="/Servlets/results">
<TD>Username &nbsp;</TD><TD><input type="text" name="txtUserid" size="20" tabindex="1"></TD>
<TD> <A href="javascript:getIDs('http://Servlets/editorslist.jsp')"><IMG src="/Servlets/searchable.gif" border="0" ALT="Get Editor User Id"> </A></TD>
function getIDs(PopUpUrl)
var ScreenWidth=window.screen.width;
var ScreenHeight=window.screen.height;
var movefromedge=0;
WinPop=window.open(PopUpUrl,"","width=400,height=300,toolbar=0,location=0,directories=0,status=0,scrollbars=0,menubar=0,resizable=0, left="+placementx+",top="+placementy+",screenX="+placementx+",screenY="+placementy+",");

in search window (.jsp)
<form name="editorlist" onclick="javascript:transfer(editorlist.editorid.value)" >
<select name="editorid" size=15 >
<%= getOptions()%>
function transfer(str)


thanks in advance.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum