Another forms question
Hello,
If I'm creating a drop down list using the tag without a size parameter, is there a way to specify how many items are shown at one time in the drop down? For example, if I have 20 choices, I'd like to have the drop down only display 5 in the drop down window, with a scroll bar to scroll through all the choices. Right now, using the code below, when I click on the drop down arrow, it creates a drop down list with 19 of the 20 choices in it, and the ability to scroll to see the 20th choice. Thanks for any help.
Bob
******************************************************
0
1 2
3 4
5 6
7 8
9 10
11 12
13 14
15 16
17 18
19 20
AndyB posted this at 02:23 — 19th August 2000.
They have: 344 posts
Joined: Aug 1999
I don't see how it could be done without the size parameter ... actually, your example has 21 choices ... zero to twenty inclusive:)
but certainly does work.
Bob posted this at 03:35 — 19th August 2000.
They have: 117 posts
Joined: Feb 2000
Andy,
Thanks, but using size=5 does not do what I want. I probably wasn't clear enough. What I want is when the form is initially displayed, I only want one value showing, 0, which I have set to selected. I want there to be an arrow to click on to give a drop down menu. I get this by not using the size parameter. What I want is to be able to control the number of choices shown in the drop down window when you click on the down arrow. Right now, when you click on the arrow, the drop down menu shows 20 choices, 0-19, and allows you to scroll to see the 21st choice (I did realize there were actually 21 choices). I want to control the size of the drop down window, so only 5 choices are shown, with the ability to scroll through the list to see all the choices. Is this possible? Thanks.
Bob
Mark Hensler posted this at 05:57 — 19th August 2000.
He has: 4,048 posts
Joined: Aug 2000
I just looked at in book I got (for HTML 4 pub in 1999). I can't find it.
Do you know of a site that does this? My advice would be to go find a workng version and look at the code.
Good luck,
-Max
Mark Hensler
If there is no answer on Google, then there is no question.
AndyB posted this at 11:55 — 19th August 2000.
They have: 344 posts
Joined: Aug 1999
So, the effect needed is that when the down arrow is clicked, the size attribute for the select changes from no value to 5.
All I can think of is that the 'real' form with a size of 5 is set in an invisible layer and when an image that looks like a dropdown is clicked, that layer disappears and the layer with the real form becomes visible.
Bob posted this at 12:10 — 19th August 2000.
They have: 117 posts
Joined: Feb 2000
Andy,
Thanks for your reply. I don't think it's worth going through all of that. I think I'll just leave it alone. I just thought it seemed like it should be a simple thing to do, like there should be a parameter to control the size of the drop down window, and I just didn't know what it was. Thanks anyway, and Max, thanks for your help also.
Bob
Vincent Puglia posted this at 16:48 — 19th August 2000.
They have: 634 posts
Joined: Dec 1999
Hi,
You might try using outerHTML to reset the size attribute, but if it works it would only do so for IE.
AndyB's suggestion of using layers is probably the better solution. If you want to see what it would involve, check out the "Hiding Selects in a Form" script/tutorial at my site. You would have to fire the display/hide with an onFocus.
You might also have to write some code so NN users can only select one option -- I believe NN defaults to select-multiple if the size is greater than 1.
Vinny
Where the world once stood
the blades of grass cut me still
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.