I have a page where I generate x number of rows each with a dropdown box. Values for the dropdown list and default selected values will be chosen on initial page load for each dropdown.
I want to write some javascript that will make it so there aren't any values that are redisplayed for any dropdown (for example, if on row 1, option #2 is chosen, option #2 shouldn't show up in any other dropdown until its deselected. Similarly, if option #2 is chosen on row 1 and option #3 is chosen on row 2, then option #2 and #3 shouldn't show up on any dropdown list until deselected).
I found some similar code here:
, but it works only for a static number of dropdown boxes and would not be easily expanded to an arbitrary # of dropdowns.
I'm pretty new to javascript still and it seems to be this may be a challenging project to start out with, but any help is greatly appreciated.
Here is some psuedo code of what my html structure is like:
The select names are dynamically generated, but this shouldn't matter what they're called as I can iterate among all dropdownlist objects in the form via javascript?
I want to write some javascript that will make it so there aren't any values that are redisplayed for any dropdown (for example, if on row 1, option #2 is chosen, option #2 shouldn't show up in any other dropdown until its deselected. Similarly, if option #2 is chosen on row 1 and option #3 is chosen on row 2, then option #2 and #3 shouldn't show up on any dropdown list until deselected).
I found some similar code here:
, but it works only for a static number of dropdown boxes and would not be easily expanded to an arbitrary # of dropdowns.
I'm pretty new to javascript still and it seems to be this may be a challenging project to start out with, but any help is greatly appreciated.
Here is some psuedo code of what my html structure is like:
Code:
<form method="post" name="licenseform">
<select name="Select2">
<option value="1">Intended For: Jon Doe -> St. Louis: 1 of 10</option>
<option value="2">Test</option>
...
<option value="n">test2</option>
<option selected value="">None</option>
</select>
....
<select name="SelectN">
Same options as above/below , but don't redisplay any options that are selected above or elsewhere
</select>
The select names are dynamically generated, but this shouldn't matter what they're called as I can iterate among all dropdownlist objects in the form via javascript?