We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Strut HTML Tags

komlaaa
komlaaa asked
on
Medium Priority
258 Views
Last Modified: 2010-04-01
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>
Comment
Watch Question

Commented:
just remove the multiple

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

fargo

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

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

Author

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

Author

Commented:
>multiple="true
Shouldn't that be multiple="false"

Author

Commented:
+ i would like to set the size = "the size of the items in the list box", not know till run time
Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

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.

Commented:
Hi,

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

regards,
fargo

Author

Commented:
Please just tell me what the difference between "drop down menu" and List menu  using <html:select> tags?

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

Author

Commented:
thanks fargo.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.