Topic: can't get width of a select box? (Page 1 of 1) Pages that link to <a href="" title="Pages that link to Topic: can&amp;#039;t get width of a select box? (Page 1 of 1)" rel="nofollow" >Topic: can&#039;t get width of a select box? <span class="small">(Page 1 of 1)</span>\

Neurotic (0) Inmate
Newly admitted

Insane since: Feb 2008

IP logged posted posted 02-09-2008 01:00 Edit Quote

Hi All,

1. I have a select box, of which the option content is variable width and just retrieved from the db.
2. I have a 800px fixed width page

when the text is too long, the box goes past the 800px fixed width. I can't seem to find a way of determining the width of the select box. the select box does not have any styling associate with it at all, and the only way to get the width is if the select box has a style="width:300px" directly in the select tag.

any ideas?


Paranoid (IV) Inmate

From: Florida
Insane since: Mar 2005

IP logged posted posted 02-09-2008 02:41 Edit Quote

If your select option's are that long, my guess is a select is the wrong route. Got a link?

Obsessive-Compulsive (I) Inmate

Insane since: Feb 2008

IP logged posted posted 02-15-2008 23:34 Edit Quote

sorry, can't get to the page without logging in. but i can explain what this is in regards to.

basically, the text is pulled from a banking site. these are basically those "forgot your password" phrases. in 99.9% of the cases, the text is not a novel, so it stays within the boundaries of the fixed-width page and container. but in some cases the text will be long enough to extend past the boundaries.

to make things even more difficult, the select box is generated via a JSTL tag, so i don't have the flexibility of changing it. In fact, the entire form is generated dynamically through this tag, something like this:

<z:enterCredentialsForm id="form1" />

re-engineering this is a major undertaking and not an interim solution.

thanks for your help.

disclaimer: this is not my design or code. the guy that came up with this no longer works here.

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 02-16-2008 00:30 Edit Quote

what is it with banks and their lax security?

Unfortunatly, if I remember correctly, you're a bit out of luck - at least in IE <= 6.
(I haven't checked recently in other browsers... but you probably still have to support netscape 4.7 )

In IE, they implemented select boxes in the easiest way possible - by reusing the windows control,
but at the same time omitted basically all css styling for them (since it couldn't apply to the
windows select box anyhow). Same reason why select boxes always float above your divs....

Could you perhaps limit the length of the question texts?
Or sell the 'it either overflows or it cut's of and there's nothing that can be done about it'...

Obsessive-Compulsive (I) Inmate

Insane since: Feb 2008

IP logged posted posted 02-16-2008 21:20 Edit Quote

Two solutions that I normally see are you detec the browser and you set the width to a different value when focused.


You detect the browser and basically rewrite the control with JavaScript and use a div element and select the values that way.


Post Reply
Your User Name:
Your Password:
Login Options: Remember Me On This Computer
Your Text:
Options: Show Signature
Enable Slimies
Enable Linkwords

« BackwardsOnwards »

Show Forum Drop Down Menu