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>
komlaaaAsked:
Who is Participating?
 
fargoCommented:
okk.

if you don't want user to select more than one, definitely you should just remove the multiple and the size attributes.

>> i would like to set the size = "the size of the items in the list box", not know till run time
You need not to set the size. Why do u wish to set the size?? It is automatically taken up by the options collection size.

regards,
fargo
0
 
fargoCommented:
just remove the multiple

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

fargo
0
 
fargoCommented:
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
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
fargoCommented:
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
0
 
komlaaaAuthor Commented:
the user shouldn't be able to select more one entry even if he/she try to press control key
0
 
komlaaaAuthor Commented:
>multiple="true
Shouldn't that be multiple="false"
0
 
komlaaaAuthor Commented:
+ i would like to set the size = "the size of the items in the list box", not know till run time
0
 
komlaaaAuthor Commented:
>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.
0
 
fargoCommented:
Hi,

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

regards,
fargo

0
 
komlaaaAuthor Commented:
Please just tell me what the difference between "drop down menu" and List menu  using <html:select> tags?
0
 
fargoCommented:
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

0
 
komlaaaAuthor Commented:
thanks fargo.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.