Reputation:
If I have a Struts
tag like this...
<s:select name="country.id" list="countries" listValue="name" listKey="id" headerValue="Select Country" headerKey="" label="Country" />`
This is the output code...
<select name="country.id" tabindex="12" id="registration_country">
<option value="">Select Country</option>
<option value="1">United States</option>
<option value="2">Afghanistan</option>
<option value="3">Albania</option>
<option value="4">Algeria</option>
...
<option value="192">Zambia</option>
<option value="193">Zimbabwe</option>
</select>
What can I do if I want to disable some values, such as options number 1, 3, and 4?
Upvotes: 2
Views: 2226
Reputation: 321
If you show the options to user, You must let he/she/it to operate.
otherwise, please disable the options or hidden the options.
And you can not "disable" a particular option in a given select component, So it's easy to hidden the options thats no need.
Upvotes: 0
Reputation: 9087
You cannot. Just loop through the collection and set the disabled attribute depending on your criteria.
Upvotes: 2