Link to home
Create AccountLog in
Avatar of komlaaa
komlaaa

asked on

Strut HTML Tags

Hi,
How do i force this list box to select only one item at time
<html:select multiple >
          <html:options collection="states" property="value" labelProperty="label" />
</html:select>
Avatar of fargo
fargo

just remove the multiple

<html:select>
         <html:options collection="states" property="value" labelProperty="label" />
</html:select>

fargo
sorry,

forget about the above post, i forgot to put the property attribute.
<html:select style="width:120px" property="nameOfProperty" name="formName">
<html:options collection="states" property="value" labelProperty="label" />
</html:select>

fargo
and id you wish to keep it multiple selection but only show one entry

<html:select style="width:120px" property="nameOfProperty" name="formName" multiple="true" size="1">
     <html:options collection="states" property="value" labelProperty="label" />
</html:select>

fargo
Avatar of komlaaa

ASKER

the user shouldn't be able to select more one entry even if he/she try to press control key
Avatar of komlaaa

ASKER

>multiple="true
Shouldn't that be multiple="false"
Avatar of komlaaa

ASKER

+ i would like to set the size = "the size of the items in the list box", not know till run time
ASKER CERTIFIED SOLUTION
Avatar of fargo
fargo

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of komlaaa

ASKER

>if you don't want user to select more than one, definitely you should just remove the multiple and the size attributes
if i do, it will turn to combo or drop down menu which i don't want.
Hi,

I don't think it is directly possible. May be you need to make use of javascript to make it happen.

regards,
fargo

Avatar of komlaaa

ASKER

Please just tell me what the difference between "drop down menu" and List menu  using <html:select> tags?
sure you are not talking about menu..correct?

AFAIK, drop down box and list box and select list are all same. There is no difference.

regards,
fargo

Avatar of komlaaa

ASKER

thanks fargo.