By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,379 Members | 1,380 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,379 IT Pros & Developers. It's quick & easy.

width of an <OPTION> in a table

P: n/a
I have a form arranged in a table (you can see an example in the page
http://cosmos.mi.iasf.cnr.it/~lssadm...elp/query.html)

The table is on three columns but has a structure like this. The part
I'm concerned with is the cell FFFFF which contains a multiple <SELECT>
list of <OPTION>s. As you can see the first two rows span more than one
column (if this has any importance).

What I want is to constrain FFFFF not to exceed a given width !

YYYYYYYYYYYYYYYYYYYYY
GGGGGGGGGGggggggggggg
FFFFFkkkkkAAAAAAAAAAA
--ok-kkkkk--buttons--

The part I'm interested in contains something like this

<SELECT NAME = "listOfFields" SIZE=8 MULTIPLE>
<OPTION>first_option_string</OPTION>
<OPTION>second_option_string</OPTION>
....
</SELECT>

The underlying OK button is associated to a javascript, which takes the
selected options, does some parsing and manipulation and appends the
result to one of the text areas in AAAAAAAA

So far I had no problems because the option strings were quite short.
Now some of my option strings can be quite long (100 to 200 characters,
corresponding to some complex mysql expressions). The result is that the
column containing FFFFF is now very wide, sometimes wider than the
screen, and one has to scroll left and right a lot.

I would like to constrain the area *displayed* as FFFFF to limited width
while the values of the options will be displayed in a truncated form,
and passed in their entirety to the javascript

+-----------+
|opt1 |
|opt2:xyz |
|long_and_tr|ncated
+-----------+

I tried things like this :

1) assigning <TD width=30%> or <TD width=200> to the table cell
containing the <SELECT>. The width specification is ignored.

2) replacing <OPTION>long_string</OPTION> with
<OPTION value='long_string>short</OPTION>

the display is short, but the short value is passed as value
to the javascript once it has been selected !

3) replacing <OPTION>long_string</OPTION> with
<OPTION label='short'>long_string</OPTION>

this is not honoured at all by any of Netscape 3, 4, 7 and Mozilla

Is there a way to limit the width of the <SELECT> or of the table cell
which contains it, which works with the above browsers ?
--
----------------------------------------------------------------------
no****@mi.iasf.cnr.it is a newsreading account used by more persons to
avoid unwanted spam. Any mail returning to this address will be rejected.
Users can disclose their e-mail address in the article if they wish so.

Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"LC's No-Spam Newsreading account" <no****@mi.iasf.cnr.it> wrote in message
news:Pi**************************************@pose idon.mi.iasf.cnr.it...
I have a form arranged in a table (you can see an example in the page
http://cosmos.mi.iasf.cnr.it/~lssadm...elp/query.html)

The table is on three columns but has a structure like this. The part
I'm concerned with is the cell FFFFF which contains a multiple <SELECT>
list of <OPTION>s. As you can see the first two rows span more than one
column (if this has any importance).

What I want is to constrain FFFFF not to exceed a given width !

YYYYYYYYYYYYYYYYYYYYY
GGGGGGGGGGggggggggggg
FFFFFkkkkkAAAAAAAAAAA
--ok-kkkkk--buttons--

The part I'm interested in contains something like this

<SELECT NAME = "listOfFields" SIZE=8 MULTIPLE>
<OPTION>first_option_string</OPTION>
<OPTION>second_option_string</OPTION>
...
</SELECT>


Use CSS:

#listOfFields { width: 10em; }

However, what are you to going to do if two of your 200-character options
start with the same couple of words? How will your users distinguish them in
the list? With such lengthy option labels, I think you may want to rethink
your user interface.

Jul 20 '05 #2

P: n/a
On Fri, 13 Feb 2004, Harlan Messinger wrote:
<SELECT NAME = "listOfFields" SIZE=8 MULTIPLE>
<OPTION>first_option_string</OPTION>
<OPTION>second_option_string</OPTION>
Use CSS:
#listOfFields { width: 10em; }
Looking on the web I found that even an online STYLE="width:400px;"
could work (but see further) except on older browsers, or even WIDTH=400
(a feature retired after Netscape 4) BUT THEY CAN BE USED ONLY TO ASSIGN
TO <SELECT> A *LARGER* WIDTH, NOT to decrease the width below the longer
option !
However, what are you to going to do if two of your 200-character options
start with the same couple of words?


That will never be the case, because all my long options are in the form
"alias:expression" and the alias IS INDEED different.

Anyhow I found a solution, involving not "label" but "value". I.e. I can
replace

<OPTION>alias:a_very_long_string_here</OPTION>

<OPTION value="alias:a_very_long_string_here">shortstring</OPTION>

This is fine in my case, where the result of the option is processed by
a javascript. It is enough to modify the js code to refer to the .value
instead of the .text property of listOfFields.

--
----------------------------------------------------------------------
no****@mi.iasf.cnr.it is a newsreading account used by more persons to
avoid unwanted spam. Any mail returning to this address will be rejected.
Users can disclose their e-mail address in the article if they wish so.

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.