We're wanting to rank people in order, but don't want to allow the same option to be selected more than once:
Person Number 1
<select name="person1">
<option value="null">Please Select an option</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
Person Number 2
<select name="person2">
<option value="null">Please Select an option</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
Person Number 3
<select name="person3">
<option value="null">Please Select an option</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
So here, if someone chooses option 1 in the first person box, all the option boxes would be repopulated with that option removed (or disabled).
Obviously the first option - null 'Please Select an Option' must be ignored.
I would also need some kind of 'reset' functionality?
No idea where to start with this, any ideas?
thanks!
If I understand correctly, you have N persons that you want to rank from 1 to N (there's nobody left out of the ranking).
If JavaScript components are an acceptable option for your context, then I would suggest you use the «Sortable» component :
It could give a better user experience than having multiple "select" elements.
EDIT : Ok I see from the comments that you really want to use N "select". As suggested by Flea777 you should look at the .change() event of JQuery, and set the "disabled" attribute on the "option" entries which have already been selected : http://www.w3schools.com/tags/att_option_disabled.asp
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.