Select (listbox) overload

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I was wondering if anyone could tell me what the character limit for a
select box (list box) is?  Also, does anyone know how to increase it?
I am running into an overflow situation.  Any help would be much

Jake G.

Re: Select (listbox) overload

Quoted text here. Click to load it

32K in some OS/browser combinations. Unlimited in others.

However if you are running in to the limit of the OS/browser then you have
far exceeded the limit of the human trying to use the select box.  Thirty or
so rows is my max (those bedamned country select lists). Any more and I
either ignore or lie.


Re: Select (listbox) overload

Scripsit Jake G:

Quoted text here. Click to load it

There is no limit. Not all characters will always be visible, though. This
depends on the browser and its settings.

Quoted text here. Click to load it

Relatively modern browsers like IE 7 and Firefox 2 make (by default) the box
as wide as needed for the longest option, so the problem is rather the
_lack_ of a limitation.

You can suggest a visible width for a select element using CSS, e.g.

<style type="text/css">
select { width: 10em; }

This may work either way: by relaxing a width limitation, or by imposing
one. Anyway, _then_ you have an overflow problem. By default, browsers
truncate the option texts. Due to the specialties of implementation, it
might not be possible to create visible or scrollable overflow.

So instead of asking how to limit the width, you should probably ask how to
cope with a select element with unpredictable varying width.

Quoted text here. Click to load it

You would appreciate help from others more if you gave them the opportunity
to help you, by posting the URL. It might tell us what the real problem is.

My bet is that the option texts are too long and should be shortened, and
quite possibly you shouldn't use a <select> element at all but a list.

Jukka K. Korpela ("Yucca")

Site Timeline