473,382 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Cascading select boxes.

We have had this script on our site for a while, and it has always
worked in any browser we have tested. It dynamically fills one select
based on the selection of another select. Unfortunatly, with the
release of NS 7, and the related Mozilla engine, this script no longer
works.

function popPresList(lstParent,lstChild){
clearPresList(lstChild);
var n = lstParent.options[lstParent.selectedIndex].value; // get the
index of the controlling select.
var k = 0;
lstChild.options[++k] = new Option('Not Selected', '0'); // add the
default selection to the child list.
if ( n > 0 )
{
for(i=0;i<aPresHolder.length;i++) // look through the array to
find the proper child array.
{
var presArray = aPresHolder[i];
if(presArray['parent']==n) // does its parent match ours?
{
txtItem = presArray['name']; // get the text
optValue = presArray['id']; /get the value
lstChild.options[++k]=new Option(txtItem, optValue); //
create a new option
}
}
}
if(k == 0)
{
lstChild.options[++k] = new Option('None Available', '0'); //if
we have no children, display to user.
}
lstChild.selectedIndex=1; // set the seletected index.
}

function clearPresList(lstChild)
{
var longi = lstChild.length;
for ( var i=0; i<=longi -1; i++ )
{
lstChild.options[i] = null; // clear the present options
}
}

The html (stripped of surrounding tables, etc,)
<select name='PRESENTATION_SELECT'
onChange='javascript:popPresList(this,PRESENTATION _SELECT_CHILD);'>
<option value='0'>Not Selected</option>
<option value=301 >Poster</option>
<option value=302 >Oral</option>
</select>
<select name='PRESENTATION_SELECT_CHILD'>
<option value='0'>Not Selected</option>
<option value=1381 >Research</option>
</select>

can anyone shed some light on why this has stopped working, and what I
must to to fix it?
Jul 20 '05 #1
2 5434
gr*********@scholarone.com (Greg) writes:
We have had this script on our site for a while, and it has always
worked in any browser we have tested. It dynamically fills one select
based on the selection of another select. Unfortunatly, with the
release of NS 7, and the related Mozilla engine, this script no longer
works.
That would be little more than a year ago, if you take the Mozilla 1.0
release as a guide. Ofcourse, Netscape 6 was based on a pre-1.0 version,
and people have been using Mozilla for several years.
can anyone shed some light on why this has stopped working, and what I
must to to fix it?


In a Mozilla based browser, if you enter "javascript:" in the address
line or start the javascript console from the menu, what error message
does it show?

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
gr*********@scholarone.com (Greg) writes:
We have had this script on our site for a while, and it has always
worked in any browser we have tested. It dynamically fills one select
based on the selection of another select. Unfortunatly, with the
release of NS 7, and the related Mozilla engine, this script no longer
works.
I am testing in Mozilla Firebird, one of the more recent versions.

Comments:
for(i=0;i<aPresHolder.length;i++) // look through the array to
The "aPresHolder" variable declaration isn't included here, so this
part is hard to test.

....
optValue = presArray['id']; /get the value
This comment needs another "/". I get an "unterminated regular
expression literal" error.
Is there a form around these select elements?
<select name='PRESENTATION_SELECT'
onChange='javascript:popPresList(this,PRESENTATION _SELECT_CHILD);'>


Here "PRESENTATION_SELECT_CHILD" is not defined as a global variable.
Try changing it to
this.form.elements["PRESENTATION_SELECT_CHILD"]
if there is a surrounding form. Otherwise try
document.getElementsById("PRESENTATION_SELECT_CHIL D")
and add the id attribute to the second select too.

The "javascript:" is unnecessary.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3

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

Similar topics

9
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
6
by: visionstate | last post by:
Hi there, I am building a database that requires cascading lists on a form. I currently have (I may be adding more later) 3 combo boxes on my form - Department, Surname and Forename. The user...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
0
by: KMEscherich | last post by:
Hi there, am wondering if there is a way to have a primary key control on a field and have this drive the cascading list boxes. I would like to have someone enter an ID(Primary Key) in a textbox...
7
kcdoell
by: kcdoell | last post by:
I have three tables: One for the Division location: tblDivision DivisionID = Autonumber DivisionName = Text One for the Working Region: tblWrkRegion
4
klarae99
by: klarae99 | last post by:
Hello, I am working on an Access 2003 Database. The tables that pertain to this issue are tblOrg, tblState, tblCity, and tblZip. I have posted the table structure with only the pertinant fields...
1
kcdoell
by: kcdoell | last post by:
Good Morning: I have a form where I am trying to create cascading combo boxes. I have done this before but I am getting the following error that is throwing me off: Procedure declaration...
3
kcdoell
by: kcdoell | last post by:
I have 5 cascading combo boxes on a form. Below is a sample of my vb in the first combo box: Private Sub CboDivision_AfterUpdate() 'When the Division is selected, the appropriate Segment...
7
by: Toireasa | last post by:
Hi, Newbie Access developer here, and my first post on this forum, so I might not get everything right - thanks in advance for your help and your patience! I'm using Access 2007, in XP. I'm...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.