[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

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>
0
komlaaa
Asked:
komlaaa
  • 6
  • 6
1 Solution
 
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
 
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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
 
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
 
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now