473,592 Members | 2,921 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pass variable to parent window and update the form filed


I am doing a web based project for my graduation. I studied bit of java
for backend processesing and javascript for the client. Here is the

In the FORM, I use INPUT TYPE=text VALUE=" " NAME=cat, and a gif next
to it. User will click on the icon to get a new window. In the new
window, the user selects a value from the pull down menu (created by
servlet from back end) and clicks OK. The value is passed back to the
opener window to variable cat. Upto this point my code works. I can see
that the variable cat changes.

How can I display the values of these variables into the fields of form
which is already loaded? May be a simple one, but me being a beginner,
I am stuck for more than 24 hours. Please help. My project dead line is
just three days away.

Thanks in advance.

Here is the test code (knowledge gained from internet) I have written
for this task.

=== Code in OPENERWINDOW.HT ML ===============
<TITLE>Open New Window</TITLE>

function showvar () {
document.write( "<BR><BR>") ;
document.write( "Value of variable parentvar is " + parentvar +".");
document.write( "<BR><BR>") ;

var parentvar = "Parent";
document.write( "Value of variable parentvar is " + parentvar +".");
document.write( "<BR><BR>") ;

<FORM ACTION="temp.ht ml" METHOD="POST">
<div id="Parent_var " class="FieldTex t"> </div> <INPUT TYPE="text"
id="Parent_var " NAME="parentvar " VALUE="Parent">
<INPUT TYPE="Button" VALUE="Get value from New Window" NAME="popup"
onClick="window .open('popup.ht ml') ">
<INPUT TYPE="Button" VALUE="Next" NAME="returned" onClick="showva r
(parentvar) ">

==== Code from POPUP.HTML =============
<TITLE>Pop Up Window</TITLE>


function sendVar (parentvar) {
document.write (" <BR><BR> Current Value of parentvar is " + parentvar
+ ".");
opener.parentva r = parentvar;




<form method="POST" action="submitt ed.html" name="Newform">
<table border="0" cellpadding="0" width="550" id="table1">
<td width="340" align="left"><f ont
color="#FF0000" >parentvar</font></td>
<td width="10">&nbs p;</td>
<td width="200"><in put type="text" name="parentvar " size="30"
<INPUT TYPE="Button" VALUE="Send to Parent Window" NAME="Click"
onClick="sendVa r (parentvar.valu e)">
<! <INPUT TYPE="Button" VALUE="Close Window" NAME="closwin"
onClick="self.c lose()"> ->

Jul 23 '05 #1
2 9239
um****@yahoo.co m wrote:
How can I display the values of these variables into the fields of form
which is already loaded?

The FAQ for this group may be of help:

You can dynamically change properties of HTML elements even after the
page has loaded through javascript. For example, you want to change the
value property of a form element:

Jul 23 '05 #2

That was really help on time. I should have applied my mind more on
reading rather than codeing. I added
document.forms. newWindow.paren tvar.value=pare ntvar. That worked. Thanks
a lot.

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: cksj | last post by:
I have a link on my web app that opens a pop-up window. In the pop-up window, the user can search for policy information. The result is displayed on a datagrid. The datagrid has 1 hyperlink column and 3 bound columns. When the user clicks the hyperlink, it passes the data of the hyperlink to the parent window. This part works great. However, I would like to pass the data on all 4 columns to the parent window. Do you know how I can do this?...
by: DCB | last post by:
Hello. I have an easy question, likely, that has me in a headspin. I have an include file to a frames based site that basically forces frames on the end user if they visit the site and hit a non-frames created page... Simply, it is: if (parent != self)
by: Raj | last post by:
Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence of events are 1) I click a button in the parent window to open a child window thru javascript window.open 2) I have some functionality in the child window that changes the data
by: mkobus | last post by:
Im relatively new, so please be patient with me... I need to update a parent .aspx screen from a popup and close the popup. Normally I would use 'window.opener.location.reload(true);self.close();' but i need the parent window not to reload or else data that the user has already entered will be lost during the IsPostBack. I need the 'Apply' button on the popup to trigger the 'Update' button on the parent screen. The script ive seen...
by: Bill Borg | last post by:
Hello all, Simple chat app, where the site owner has a master window with all requests for chat, status of each room, etc., and child windows for each separate chat in which the owner is engaged. When the owner closes one of his child windows, I want to update the master window. I understand "reasonably" well how to go about this. The master window launches the children, and maintains an associative array to keep track of each one....
by: strawberry | last post by:
In the function below, I'd like to extend the scope of the $table variable such that, once assigned it would become available to other parts of the function. I thought 'global $table;' would solve this but it's clear that I'm misunderstanding $variable persistence. I posted a similar enquiry over at alt.php.mysql, but I guess this is a more appropriate forum because the problems I'm having relate to PHP. Any help appreciated. ...
by: praveenit | last post by:
hi, I am writing a small java script code where , when the textbox is clicked a pop up window is opened . on entering some data in the text area present in pop up window and pressing ''save" button the pop up is closed and the value is put in the text box of parent window. Now the value is getting passed from pop up to parent but from parent to pop up i am unable to pass the value. the following is the code to pass the value from pop up to...
by: =?Utf-8?B?Umljaw==?= | last post by:
I have seen examples of passing data from FormB to FormA (Parent To Child) but I need an example of passind data from FormA to FormB. My main form is FormA; I will enter some data in textboxes and click a button to bring up FormB which needs to display values entered in FormA. Thanks in advance.
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms. Here is a newbie mistake that I found myself doing (as a newbie), and that even a master programmer, the guru of this forum, Jon Skeet, missed! (He knows this I'm sure, but just didn't think this was my problem; LOL, I am needling him) If...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.