471,627 Members | 1,284 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Problems and questions regarding HTML form SELECT elements

Hi,

I've been searching the net all day today trying to figure out how one
would accomplish what I originally thought would be a fairly straight
forward and simple thing. The problem I'm trying to solve is that the
designer would like to limit the total number of entires shown when
you click on the drop-down arrow of a select box. I'm starting to
think that this isn't possible.

I've tried the following with no luck:

- Setting the height attribute on the select element
- Setting a style height for the select attribute
- Modifying the same through Javascript
- Setting the style overflow-y to scroll
- Setting the size of the select element

At some point in my browsing someone claimed that the vertical scroll
bars are controlled by the OS/Browser and there are no ways to change
this using JS or CSS. That the magic number of IE is 30 entries before
the vertical scroll bar shows up.

That's where I'm at right now. Can anyone help shed some light on this?

Sep 18 '07 #1
3 4172
Gazing into my crystal ball I observed Matthew Cox
<Ma***********@gmail.comwriting in news:1190155091.240101.234260
@k79g2000hse.googlegroups.com:
Hi,

I've been searching the net all day today trying to figure out how one
would accomplish what I originally thought would be a fairly straight
forward and simple thing. The problem I'm trying to solve is that the
designer would like to limit the total number of entires shown when
you click on the drop-down arrow of a select box. I'm starting to
think that this isn't possible.

I've tried the following with no luck:

- Setting the height attribute on the select element
- Setting a style height for the select attribute
- Modifying the same through Javascript
- Setting the style overflow-y to scroll
- Setting the size of the select element

At some point in my browsing someone claimed that the vertical scroll
bars are controlled by the OS/Browser and there are no ways to change
this using JS or CSS. That the magic number of IE is 30 entries before
the vertical scroll bar shows up.

That's where I'm at right now. Can anyone help shed some light on
this?
>
I know you can do the checking server side, eg. (asp)
if ubound(split(selectbox,", ")) number then
'too much
elseif selectbox = "" then
'nothing at all
else
'just right
end if

I would image there might be a way to do that client side, but I'm not a
javascript person. Maybe post to comp.lang.javascript for a better
answer.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Sep 19 '07 #2
Scripsit Matthew Cox:
I've been searching the net all day today trying to figure out how one
would accomplish what I originally thought would be a fairly straight
forward and simple thing.
Since it appears to be something presentational, it would have been natural
to start from CSS, not HTML.
The problem I'm trying to solve is that the
designer would like to limit the total number of entires shown when
you click on the drop-down arrow of a select box. I'm starting to
think that this isn't possible.
Just tell the dee-ziner that it isn't possible. If it isn't strictly true,
it's just a white lie. It's certainly not possible in HTML, and it wouldn't
be useful anyway. The real problem is in the dee-ziner's mind: (s)he wants
controls to look cool, instead of being useable. That's a particularly bad
way of being control freak.

Drop-down controls created using select boxes are relatively rarely the best
way to deal with a one-out-of-many choice, and a manifestly poor approach to
many-out-of-many choices. For a general discussion, see
http://www.cs.tut.fi/~jkorpela/forms/choices.html

If the default behavior for the drop-down is not suitable, the odds are that
you are way beyond the scope of applicability of <select>. If you want fewer
options to pop up, then you are just a control freak, or a slave of a
control freak. (I'm trying hard to express this stronger, but I'm so poor in
such things.)
At some point in my browsing someone claimed that the vertical scroll
bars are controlled by the OS/Browser and there are no ways to change
this using JS or CSS.
Could be. In any case, it would be browser dependent and would depend on
non-HTML technologies that might be switched off for various reasons.
That the magic number of IE is 30 entries before
the vertical scroll bar shows up.
Could be. It was when I just tested it: with 30, no scroll bar, with 31,
scroll bar. This might sound nasty if you planned to use <selectfor
selecting day of month, but who on &Planet; would dream of doing so? :-)
Typing in one or two digits is surely easier than picking up a number from a
list of 31 numbers.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Sep 19 '07 #3
Matthew Cox wrote:
Hi,

I've been searching the net all day today trying to figure out how one
would accomplish what I originally thought would be a fairly straight
forward and simple thing. The problem I'm trying to solve is that the
designer would like to limit the total number of entires shown when
you click on the drop-down arrow of a select box.
Even though that could only make sense in a very narrow set of
presentation layouts, strangely, there's a standard way to give a size
information (just a guideline) in HTML:
http://www.w3.org/TR/html4/interact/forms.html#h-17.6

This applies to list box representations, not to "drop-down boxes", but
user agents are free to interpret them as they wish.
Actually, IE6 behavior is to use a list box with N rows whenever SIZE=N is
specified, otherwise, a combo box is used, even when there's only one or
two options!

Opera 8.54, Mozilla 1.7, Netscape 1.22 & higher and 1X 1.0 share the same
behavior on Win32 as well as Opera and Dillo on GNU/Linux, but other
behaviors, such as the one of Elinks, are perfectly sane.

I'm starting to
think that this isn't possible.
It isn't. The designer cannot *limit* the total number of entries "viewed"
at once for any sense of the word "viewed". HTML isn't an imperative
language, it is a declarative language.
You can just give a guideline, interpreted or not, depending on whether it
makes sense to the user agent and whether the user agent or the user
wishes to accept this imposed value.
At some point in my browsing someone claimed that the vertical scroll
bars are controlled by the OS/Browser and there are no ways to change
this using JS or CSS.
With ActiveX, you can. But ActiveX is a quite offensive technology:
Executing arbitrary binary code on the client machine.
That the magic number of IE is 30 entries before
the vertical scroll bar shows up.
This probably depends on the OS and version of IE and maybe user settings,
screen resolution and font sizes.
With Windows 98 SE and IE6, for 12 or more entries, there's a scroll bar.

--
You can contact me at <ta*****************@yahoDELETETHATo.fr>
Sep 22 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Michael Fork | last post: by
5 posts views Thread by doc | last post: by
9 posts views Thread by please-answer-here | last post: by
17 posts views Thread by Lloyd Sheen | last post: by
2 posts views Thread by rehevkor5 | last post: by
2 posts views Thread by justplain.kzn | last post: by
1 post views Thread by XIAOLAOHU | last post: by

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.