View Full Version : Drop down menu query
sarah
10-01-2002, 03:10 PM
Hi,
I have created 2 drop down menus, I want to populate the second dropdown menu depending on what the user selects on the first dropdown menu, but I'm not sure how to go about it.
If anyone knows of any good tutorials or can give me a working example I would really appreciate it.
Thanx Guys
Luv Sarah
Alekz
10-01-2002, 03:14 PM
Hi,
It depends on where the data You'll use to populate the second combo box is located... On a server? Client Side in a JavaScript array? In a XML data island? Somewhere else...?
Alex
sarah
10-01-2002, 05:02 PM
Hi Alekz,
I'm not sure at the moment, it just depends on which is the easiest way. I've seen this done on a number of websites and wish to achieve something similar.
The simplest way would be the best, if its easier to code the data in an array then thats way it will be. I'm not sure on how to go about it so all the advice available will be appreciated.
What I want to be able to do is when a user selects the colour green in the first menu, all the green items that are available show up in the second menu. If a user selects the colour red, then all the red items appear on the second menu, and so on...
If the user wants to see all the items available, then they check a radio button and this populates the second menu with all the items.
Based on the situation above do you suggest that I should use an array or should the data reside on the server?
chrismiceli
10-02-2002, 01:51 AM
http://javascriptkit.com/script/cut183.shtml
i think this is what you want.
Alekz
10-02-2002, 09:43 AM
Hi,
In the example chrismiceli posted, data is located in JavaScript arrays embedded into the HTML page. I'd suggest to link that array instead of ebedding it, like this
<script Language="JavaScript" src="myData.js"></script>
Even if You don't have a database at the moment, somewhere in the future You may have one and You'll need to populate comboboxes with a server side script. Linking the script this way means You''ll not have to change the HTML, just the source of the script: myData.js -> myData.asp. The ASP will have to access the database and output the proper client side JS array...
Alex
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.