html <select> and <option> query

Hi,

I am using the html <select> and <option> tags in my jsp file to populate 4 drop down menus. What I want to do is display all four options in the first drop down menu. When the user chooses an option the second drop down menu will only display the three remaining options. Is this possible?

Many thanks.

[338 byte] By [aod8a] at [2007-10-2 8:53:51]
# 1
you can do this through javascript.
gmachamera at 2007-7-16 22:57:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

ok... so do you have 4 drop downs or 2 drop downs... I'm going to assume you have 2 drop downs with the same 4 options in each... You want to choose an option in the first and then remove that option from the second? I'm going to go with this assumption.

I would create the first drop down like you want. I would not create the second drop down until after the user makes a selection from the first. In javascript you could clone the first one and remove the item you no longer want to display and then render the drop down.

put this in a javascript method that is fired after the first combo is chosen

var myElement = document.getElementById('firstDropDown');

var el = myElement.cloneNode(true);

make sure to assign an id to the first combo box.

off the top of my head I don't know the code to modify what is in the new object el... but it shouldn't be too hard.

gmachamera at 2007-7-16 22:57:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...