PDA

View Full Version : Updating one dropdown with another



drj201
10-31-2007, 07:10 PM
Firstly hello all!

I have a drop down list box with values "A", "B" and "C".

When I select for example "A" I wish for anothe drop down list box to populate with say "1", "2" and "3". If the user selects "B" in the first combo box the second will populate with "4", "5", "6" etc.

Basically I wish to populate a second drop down list box with values dependant on what has been chosen in drop down box 1.

Does that make sense?

I have an onChange function call for the first combobox that will call a function which will hopefully populate the second combo box...

I can get it to populate a standard field ala document.myform.mytextbox.value="test"; but this does not work with a <select> drop down box.

Please help.

Thanks :cool:

boogyman
10-31-2007, 07:15 PM
http://twey.co.uk/?q=forms

drj201
10-31-2007, 11:36 PM
Hi boogyman. That doesnt really help me. I wish to populate a second drop down list after a selection from the first....

djr33
10-31-2007, 11:49 PM
Title has been updated to be more descriptive.
When posting, use a title that summarizes the question. We know it's a javascript question, and simple isn't really helpful.

In fact, this isn't all that simple. Easy concept, but the code can be a bit hard.

Consider a few options--
You could change the contents of a div to reflect what you want;
You could rewrite the options for a select menu;
Or you could swap several instances of the menu, perhaps the best option.

jscheuer1
11-01-2007, 05:14 AM
http://www.dynamicdrive.com/dynamicindex16/chainedselects/index.htm

Mozie
11-01-2007, 01:26 PM
http://www.dynamicdrive.com/dynamicindex16/chainedselects/index.htm

Chanied Selects work well, I've used this particular script a couple of times ;)