473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

width of an <OPTION> in a table

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
2 7092

"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andrea | last post by:
Hi, I'm trying to emulate part of our client-server application as a web site so customers can use it, and I'm stuck when it comes to re-ordering items in a list. Basically we have a list of...
1
by: Ang Talunin | last post by:
Hey, I wondering if it's possible to retrieve all the <option>-fields from a <select> when posting a <form> to a php file Example: I've got a form like this: <form action = phpfile.php...
6
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this...
6
by: joseph.lindley | last post by:
Forgive me for I am a bit of a web-dev novice - but I'm not doing too bad. I'm currently working with a bit of javascript to dynamically add <option>s into a select box. My code currently works...
1
by: frey | last post by:
i tried to create a dropdown menu and use the option as a control to change content inside another text area the code is like this: <select name="xxxx"><option onclick="changeunitprice(29.87)"...
4
by: Man-wai Chang | last post by:
-- iTech Consulting Co., Ltd. Expert of ePOS solutions Website: http://www.itech.com.hk (IE only) Tel: (852)2325 3883 Fax: (852)2325 8288
4
by: pplers | last post by:
Here is config.php: <?php //The vars are all ok. $dbhost = 'localhost'; $dbname = 'forum'; $dbuser = 'toor'; $dbpass = ''; ?> Here is a part of functions.php: <? require "config.php"; //It...
14
by: The Natural Philosopher | last post by:
This is a nasty one and I can't see my way out of it. I have a bunch of select statements in a form, and each select statement has an onchange="do_something(this)" in it, and this works...
14
mikek12004
by: mikek12004 | last post by:
In a form I have 5 elements (e.g. pictures) and I wish for the user to be able to set the order of appearance. For this I have for each picture a select box (names select1 to select5) with "please...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.