File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes drop down list box height Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "drop down list box height" Watch "drop down list box height" New topic
Author

drop down list box height

Rajni Patel
Ranch Hand

Joined: Sep 03, 2009
Posts: 84
Hi,

I have created one drop down list box in jsp page using struts1.

There is 25 value in drop down list box. I don't want to make list too long. If it make small and then scrollbar will come in list.

could I set the height of list box? any suggestion?

Thanks in advance.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

You cannot set the size of the opened drop-down, only the width of the unopened control.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

What I feel is if you have more records in the drop down which doesn’t fit in page then you convince the customer to compromise having it as selection popup (the best way).
however, you can still have dirty work arounds like playing with the visibility settings of div though..

Have Fun with Java
little,little.. little by little makes a lot..
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Shankar Tanikella wrote:however, you can still have dirty work arounds like playing with the visibility settings of div though..


HUH? What are you talking about? How does this apply to a select element?

Eric
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

as i already mentioned dirty.. it is really dirty...

Anyways, what i fell is it is still to do something like below, didn’t try it though

For example, if i have 20 options, i shall iterate till 10 to show the recently used or something but only few in number, for now say 10 and the 11th option would be "...". All this setup would be in a div, and be visible on load on page
when user selects "..."
we shall block this and show another div with all elements (since user asked for it, it would be displayed)...

Doesn't this work?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

It still has nothing at all to do with an HTML select element.

If the <select> element is unsuitable, it's certainly possible to create a custom widget using other HTML elements. In such a case I would not recommend anyone build their own, but rather use one of the existing widgets such as the jQuery UI Autocompleter widget.
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Perfect,
But i still go with a popup with radio button which is easier to implement (if the application is not rich in UI). If UI is rich then yes, to match with other screen elements JQuery is the best one. If Jquery is already in use then also Ok since there would be less learning to do. But only for this one select box? Moreover, its is Struts1 application, rich UI ??
Rajni Patel
Ranch Hand

Joined: Sep 03, 2009
Posts: 84
I am not using jquery. could i set dropdown list box height with java script?

thanks,
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Again, no. Nothing on Earth can change the drop-down height except rewriting the browser itself.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: drop down list box height
 
Similar Threads
Combo Box search as user types
Removing vertical scrollbar in a dropdown
How to enable check box on select particular value from dropdown box
how jsf component get the value from backing bean instead of submitted value after validation error
add or remove an item from drop down