473,394 Members | 1,802 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,394 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 4226
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Michael Fork | last post by:
Note: I pasted the code the attachments as plain text after the message (I wasn't able to post it with an attachment...) Attached are the XSL and XML files that I am having problems with. I am...
3
by: Ondernemer | last post by:
Hi guys, On my page I dynamically create different checkboxes. <input type="checkbox" name="ch1" value="some value"> option 1 <input type="checkbox" name="ch2" value="some value"> option 2...
5
by: doc | last post by:
Hi, <SCRIPT LANGUAGE="JavaScript"> function check_selection(selection){ document.pr.n_o.checked=true; } </SCRIPT> <form name=pr action=test.php method=post>
9
by: please-answer-here | last post by:
What is wrong with this code? when i place "return false" before the xfab assignment the form as intended doesn't submit. But when placed as here or in the last if/else construct the page gets...
22
by: Luke | last post by:
Elements with name attribute: form, input, textarea, a, frame, iframe, button, select, map, meta, applet, object, param, img (if you know more reply...) Methods of addresing html elements:...
17
by: Lloyd Sheen | last post by:
This IDE is driving me nuts. I needed another button so I copied an existing one, changed the Text and the id and position by drag and drop. Well then I run and get the following: Control...
38
by: Luke Matuszewski | last post by:
Welcome I have read the in the faq from jibbering about the generic DynWrite, but i also realized that is uses only innerHTML feature of HTML objects. (1) Is there a DOM function which is very...
2
by: rehevkor5 | last post by:
I have written Javascript which populates a form with <select> elements dynamically based on some other stuff going on in the page. The problem is that I can't get it to work properly in IE, and...
2
by: justplain.kzn | last post by:
Hi, I have a table with dynamic html that contains drop down select lists and readonly text boxes. Dynamic calculations are done on change of a value in one of the drop down select lists. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.