This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Struts and the fly likes decreasing width of drop down box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » Struts
Bookmark "decreasing width of drop down box" Watch "decreasing width of drop down box" New topic

decreasing width of drop down box

Ketan Parekh

Joined: Sep 15, 2005
Posts: 20
Hi folks, i am populating a drop down from database in a jsp page.

The values retrieved are longer so the drop down width size increases to the highest length of the value and it makes the form look dirty.

is there any way to solve this problem. how can i shrink the drop down box, if possible can the box being displayed on clicking drop down be bigger than the actual dropdown width.

my code is

<html:select property="name" onchange="getname(this)">

<html ptions collection="nameDetails" property="nameID" labelProperty="Name" />

Siddharth Naik
Ranch Hand

Joined: Apr 09, 2006
Posts: 35
You might be able to use attribute styleClass of struts html:select tag. This styleClass is similar to class attribute in html select tag and can be customized in CSS file.

For example in CSS you can use code like this:

You can then use styleClass="FormBox50" in html:select tag.

Hope this works out for you.

Thanks<br />Sid
Ketan Parekh

Joined: Sep 15, 2005
Posts: 20
Thanks Sid, it really worked.
I agree. Here's the link:
subject: decreasing width of drop down box
jQuery in Action, 3rd edition