473,549 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(lst Parent,lstChild ){
clearPresList(l stChild);
var n = lstParent.optio ns[lstParent.selec tedIndex].value; // get the
index of the controlling select.
var k = 0;
lstChild.option s[++k] = new Option('Not Selected', '0'); // add the
default selection to the child list.
if ( n > 0 )
{
for(i=0;i<aPres Holder.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.option s[++k]=new Option(txtItem, optValue); //
create a new option
}
}
}
if(k == 0)
{
lstChild.option s[++k] = new Option('None Available', '0'); //if
we have no children, display to user.
}
lstChild.select edIndex=1; // set the seletected index.
}

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

The html (stripped of surrounding tables, etc,)
<select name='PRESENTAT ION_SELECT'
onChange='javas cript:popPresLi st(this,PRESENT ATION_SELECT_CH ILD);'>
<option value='0'>Not Selected</option>
<option value=301 >Poster</option>
<option value=302 >Oral</option>
</select>
<select name='PRESENTAT ION_SELECT_CHIL D'>
<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 5442
gr*********@sch olarone.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*********@sch olarone.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<aPres Holder.length;i ++) // look through the array to
The "aPresHolde r" 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 "unterminat ed regular
expression literal" error.
Is there a form around these select elements?
<select name='PRESENTAT ION_SELECT'
onChange='javas cript:popPresLi st(this,PRESENT ATION_SELECT_CH ILD);'>


Here "PRESENTATION_S ELECT_CHILD" is not defined as a global variable.
Try changing it to
this.form.eleme nts["PRESENTATION_S ELECT_CHILD"]
if there is a surrounding form. Otherwise try
document.getEle mentsById("PRES ENTATION_SELECT _CHILD")
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
6747
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 second combo to change depending on what values the user selects in the first box, it's just that every time the user changes the first combobox, the...
6
2075
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 chooses the department they want and then the corresponding surnames from that department can be chosen from the Surname box and then the Forename...
4
64544
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 determines the available options in the other. TERMINOLOGY Row Source: The table/query from which the Combo Box or List Box gets its values. Note:...
0
1136
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 control and have the cascading list boxes display the information accordingly. After that, then have the ID and the information in the cascading list...
7
2532
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
3471
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 below. tblOrg OrgID, AutoNumber, PK ZipID, Number, FK tblState StateID, AutoNumber, PK
1
2663
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 does not match description of event or procedure having the same name. Basically have three tables: One for the Division location:
3
3973
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 list will 'display in the drop down list of CboSegment With Me! If IsNull(Me!cboDivision) Then
7
5820
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 currently trying to set up a whole pile of cascading combo boxes of different levels of complexity, so I started with the easiest set - and can't even...
0
7451
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7960
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...
1
7475
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6048
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...
0
5089
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...
0
3501
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...
0
3483
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1944
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
0
766
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...

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.