views:

441

answers:

3

Hi, if I have a for example this struts tag:

<s:select name="country.id" list="countries"
listValue="name" listKey="id" headerValue="Select Country" headerKey="" label="Country" />

output is the following html 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 shall I do, if I wanna the option number 1, 3, 4 disabled?

A: 

Yea, I agree that i cannot.

you should accept answer number 1 if you agree.
Nathan Feger
+1  A: 

You cannot. Just loop through the collection and set the disabled attribute depending on your criteria.

Blake Pettersson
A: 

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.

Cong De Peng