473,659 Members | 2,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updating The Drop-Down List On One Window From Another

Hi All,

I'm trying to alter the contents of a drop-down (select) list on the
parent window from a child window in IE 6. After opening the child
window, I set its opener to reference the parent like this:

childwin = window.open(... )
if (childwin == null)
childwin.opener = self;

Then, to update the parent select list from the child window, I do
this:

opener.document .myForm.NameOfS elect.options.l ength = 0;
opener.document .myForm.NameOfS elect.options[0] = new Option("", "");
for (var ixy = 1; ixy <= newDataArray.le ngth; ixy++)
{
opener.document .myForm.NameOfS elect.options[ixy] = new
Option(someNewD isplayText, newValue);
}
This looks correct and works up to a point. I can empty the parent
select by setting the its options.length to zero. But, when I try to
add new options, IE gives me a "server threw an exception" message.
Is all this even possible in IE?

TIA.
Jul 23 '05 #1
2 2299
Hi Robert
The following works in IE5 with no doctype. I hope it helps
Jimbo

html file to with list and button to open new window
<HTML><HEAD><TI TLE>populate select opener</TITLE>
<script type=text/javascript>
var listOptions=new Array("Sat","Su n","Mon","Tues" ,"Wed","Thurs", "Fri");
function changeList(inde x) {
// use index to decide how to populate list
// this example uses the listOptions array
var a=document.form s["whatever"].elements["openerList "];
for (var i=0;i<listOptio ns.length;i++)
a[i]=new Option(listOpti ons[i]);
}
function openNewWin() {
winRef=window.o pen("popselectw in2.htm");
}
</script></HEAD>
<BODY>
<form name="whatever" >
<select name="openerLis t"><option>day1 <option>day2</select>
<button onclick="openNe wWin()">Open Window</button></form>
</BODY></HTML>
html for window that gets opened
<HTML><HEAD> <TITLE>popula te select in opener</TITLE></HEAD>
<BODY>
<select
onchange=window .opener.changeL ist(this.select edIndex)><optio n>one<option>tw o
</select>
</BODY></HTML>
I hope this helps
"Robert Nurse" <rn****@cudbyte ch.net> wrote in message
news:a9******** *************** **@posting.goog le.com...
Hi All,

I'm trying to alter the contents of a drop-down (select) list on the
parent window from a child window in IE 6. After opening the child
window, I set its opener to reference the parent like this:

childwin = window.open(... )
if (childwin == null)
childwin.opener = self;
The above code is suspicious. if(childwin==nu ll) the window wasn't opened
and your reference to childwin.opener and further assignment should at least
throw a fit if not an exception.

Then, to update the parent select list from the child window, I do
this:

opener.document .myForm.NameOfS elect.options.l ength = 0;
opener.document .myForm.NameOfS elect.options[0] = new Option("", "");
for (var ixy = 1; ixy <= newDataArray.le ngth; ixy++)
{
opener.document .myForm.NameOfS elect.options[ixy] = new
Option(someNewD isplayText, newValue);
}
looks OK. maybe window.opener is safer
This looks correct and works up to a point. I can empty the parent
select by setting the its options.length to zero. But, when I try to
add new options, IE gives me a "server threw an exception" message.
Is all this even possible in IE?

TIA.

Jul 23 '05 #2
Hi Jimbo,

You're exactly right! I had to set up a function on the parent window
for the child to call so that it could update the list on the parent.
Phew, that was a mouthful. Anyway, thanks for you suggestion.

"J. J. Cale" <ph****@netvisi on.net.il> wrote in message news:<41******* *@news.012.net. il>...
Hi Robert
The following works in IE5 with no doctype. I hope it helps
Jimbo

html file to with list and button to open new window
<HTML><HEAD><TI TLE>populate select opener</TITLE>
<script type=text/javascript>
var listOptions=new Array("Sat","Su n","Mon","Tues" ,"Wed","Thurs", "Fri");
function changeList(inde x) {
// use index to decide how to populate list
// this example uses the listOptions array
var a=document.form s["whatever"].elements["openerList "];
for (var i=0;i<listOptio ns.length;i++)
a[i]=new Option(listOpti ons[i]);
}
function openNewWin() {
winRef=window.o pen("popselectw in2.htm");
}
</script></HEAD>
<BODY>
<form name="whatever" >
<select name="openerLis t"><option>day1 <option>day2</select>
<button onclick="openNe wWin()">Open Window</button></form>
</BODY></HTML>
html for window that gets opened
<HTML><HEAD> <TITLE>popula te select in opener</TITLE></HEAD>
<BODY>
<select
onchange=window .opener.changeL ist(this.select edIndex)><optio n>one<option>tw o
</select>
</BODY></HTML>
I hope this helps
"Robert Nurse" <rn****@cudbyte ch.net> wrote in message
news:a9******** *************** **@posting.goog le.com...
Hi All,

I'm trying to alter the contents of a drop-down (select) list on the
parent window from a child window in IE 6. After opening the child
window, I set its opener to reference the parent like this:

childwin = window.open(... )
if (childwin == null)
childwin.opener = self;


The above code is suspicious. if(childwin==nu ll) the window wasn't opened
and your reference to childwin.opener and further assignment should at least
throw a fit if not an exception.

Then, to update the parent select list from the child window, I do
this:

opener.document .myForm.NameOfS elect.options.l ength = 0;
opener.document .myForm.NameOfS elect.options[0] = new Option("", "");
for (var ixy = 1; ixy <= newDataArray.le ngth; ixy++)
{
opener.document .myForm.NameOfS elect.options[ixy] = new
Option(someNewD isplayText, newValue);
}

looks OK. maybe window.opener is safer

This looks correct and works up to a point. I can empty the parent
select by setting the its options.length to zero. But, when I try to
add new options, IE gives me a "server threw an exception" message.
Is all this even possible in IE?

TIA.

Jul 23 '05 #3

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

Similar topics

11
16158
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? 1) simply UPDATING the values for all fields in the table, whether or not any particular field has actually changed 2) running a second SELECT statement and comparing the $_POST vars to the returned values, and only UPDATING those that have...
7
2491
by: Paige | last post by:
I have a database on my local machine that I make entries and corrections on. I'd like to be able to upload that to my server and have that update the database that's on the server. What I've been doing is saving the local file as a backup. Then I have to edit the backup, deleting the create file info and all previously uploaded entries before I can import the text file to the server. Is there an easier way to do this so I won't get...
4
2690
by: Sky Fly | last post by:
Hello all, I've written a stored procedure which runs OK for the first few thousand records it processes, then around about the 10,000th record it suffers a sudden and dramatic drop in performance (from about 40 records per second to about 1 per second). I've found that when this happens, if I run an UPDATE STATISTICS query on the affected tables, performance picks up again,
8
11594
by: pb648174 | last post by:
I have a single update statement that updates the same column multiple times in the same update statement. Basically i have a column that looks like .1.2.3.4. which are id references that need to be updated when a group of items is copied. I can successfully do this with cursors, but am experimenting with a way to do it with a single update statement. I have verified that each row being returned to the Update statement (in an...
5
4469
by: deko | last post by:
How to run action query against linked table? I have an Access 2003 mdb with an Excel 2003 Workbook as a linked table. When I attempt to run an action query against the linked table I get this error: Deleting data in a linked table is not supported by this ISAM. From what I understand, indexed sequential access method (ISAM) drivers are used to update "non-Microsoft" file formats. So why doesn't Access
1
1729
by: teddyparnell | last post by:
I have a query that works, but then displays the results in a datasheet view. The query is reliant on the results of a combo box, and when i update this combo box and click a button the results of the select query are displayed in a data sheet. What i would like is for the results to be displayed in a subform on this form possibly in a series of txt boxes and memo boxes, but if not, a data sheet view will be fine. I have this kind of...
8
1377
by: Zest4Csharp | last post by:
hi, I have a database table without a key field. I managed to view the contents of the table through a DataSet in a DataGrid in C#. The user can edit the data in the grid. Can someone show me how to update the sourse database? I cannot use a standard 'WHERE' claus simply because there is no key field in the source table.
4
2600
by: Dave Taylor | last post by:
I've been using the dataset designer in Visual Studio to create typed datasets for my application by dragging over tables from the Server Explorer and dropping them into the designer. The problem is, when I modify these tables in SQL Server (typically adding fields and what not), there doesnt seem to be an easy way to update the typed dataset. If I delete the previous table definition and drop a new one on, all of the relationships are...
3
4632
by: John Morgan | last post by:
I have my first small SQl Server 2005 database developed on my local server and I have also its equivalent as an online database. I wish to update the local database (using and asp.net interface) and then to upload the data (at least the amended data, but given the small size all data should be no trouble) to the online database. I think replication is the straight answer but I have no experience of this and I am wondering what else...
2
2777
by: breimer | last post by:
I have created a simple database with a single date field & inserted the current date. What I need to do is alter the day portion of this date field to be a value of 01 if the day of the current month is less than 21, otherwise the value should be 20. Thanks..bill Here's a sample of the code I am attempting to use: code=DB2 -- drop date table drop table REIMEB2.DATE_TABLE; -- create date table CREATE TABLE REIMEB2.DATE_TABLE...
0
8851
Oralloy
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...
0
8751
jinu1996
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...
0
8629
tracyyun
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...
0
7360
agi2029
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...
1
6181
isladogs
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...
0
5650
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();...
0
4176
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...
1
2757
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
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.