472,965 Members | 2,186 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Have a very long select element repeated

Hi All

I have to build a page which includes a select element (as a drop down
menu) with all the country names in it. However I just found out that
the need to be repeated many times so the client can select as many
country as they can in their around the world trip planning.

I don't want to repeat this long list multiple times, because I want
to save bandwidth. Is there a more efficient way to do this rather
than using JavaScript to repeat the code on the client side? (which I
don't know how to do yet).

Thanks

Aug 22 '07 #1
7 3462
Scripsit mc*****@gmail.com:
I have to build a page which includes a select element (as a drop down
menu) with all the country names in it.
Tell the people who told you to do that what the drawbacks are. You should
be able to list down half a dozen good reasons easily.
However I just found out that
the need to be repeated many times so the client can select as many
country as they can in their around the world trip planning.
Technically, it need not be repeated, since you can use the MULTIPLE
attribute in the select element. However, people will generally not know
that they can select multiple elements and how to do that, and even if they
do, its is a nightmare to actually make such selections.

Using a set of checkboxes (associated with country names) would produce
_much_ better usability. Users would have to scroll the _page_ then, but is
this any worse than having to scroll the drop down _menu_? No, it's actually
much better, more useable.

Perhaps even better, you could include a text input field (input type="text"
or textarea) where people can type in the names of the countries. You would
then need to parse - in the server-side form handler - the names, maybe even
with synonym recognition and loose matching (taking, say, "finland",
"finnland", and "finlandia" all matching "Finland"). More work to you, maybe
better usability to users.

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

Aug 22 '07 #2
Jukka K. Korpela wrote:
Scripsit mc*****@gmail.com:
>I have to build a page which includes a select element (as a drop down
menu) with all the country names in it.

Tell the people who told you to do that what the drawbacks are. You should
be able to list down half a dozen good reasons easily.
[...]
Using a set of checkboxes (associated with country names) would produce
_much_ better usability.
My sentiments exactly: Dropdown menus are almost always bad. To select one
or more items out of FEW choices, use radiobuttons or checkboxes.

For a larger number of choices, use text entry boxes and parse the result
server-side.

I always love it when I'm looking for a local representative of a company
that has a handful of offices around the world, and the web droid who did
the page crammed every country in existence into a drop-down list.

Or credit card expiration dates from the past.

Or birth year selectors that go from 1900 to 2007.

Or all the other shit with which marketing folks cripple potentially useful
web pages.

robert
Aug 22 '07 #3
Scripsit Robert Latest:
I always love it when I'm looking for a local representative of a
company that has a handful of offices around the world, and the web
droid who did the page crammed every country in existence into a
drop-down list.
.... as well as some non-existent countries, such as "Serbia and Montenegro",
and missing some of the existing countries, like "Serbia" and "Montenegro".

Allowing _all_ countries (for some definition for "country") might be
adequate e.g. in a form where you ask for a user's postal address or
nationality. Then the list of countries needs to be maintained somehow,
since changes _will_ take place. It need not be more difficult to maintain
it in the HTML source than to maintain it in the form handler, though. The
point is that one shouldn't aim at a list of all countries unless it's
really _needed_.

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

Aug 22 '07 #4
Robert Latest wrote:
My sentiments exactly: Dropdown menus are almost always bad. To select
one
or more items out of FEW choices, use radiobuttons or checkboxes.

For a larger number of choices, use text entry boxes and parse the result
server-side.
That's one of the rare occasion where AJAX can slightly improve user's
experience by providing auto-completion when typing the country name in a
text entry box, as Google Suggest does.

Of course, it's just an *improvement*. The code must be written without
JavaScript, and then, add the JavaScript code that intercepts key strokes.

--
You can contact me at <ta*****************@yahoDELETETHATo.fr>
Aug 22 '07 #5
Jukka K. Korpela wrote:
Using a set of checkboxes (associated with country names) would produce
_much_ better usability.
Generally I would agree, but in this case there are over 300 items in
the list. Checkboxes aren't a good alternative when there are that many
items.
Perhaps even better, you could include a text input field (input
type="text" or textarea) where people can type in the names of the
countries. You would then need to parse - in the server-side form
handler - the names, maybe even with synonym recognition and loose
matching (taking, say, "finland", "finnland", and "finlandia" all
matching "Finland"). More work to you, maybe better usability to users.
Yes. If the user knows which countries he wants to visit, allowing him
to type them, rather than sort through an exhaustive list to find them
would be better.
Aug 22 '07 #6
Scripsit Scott Bryce:
Jukka K. Korpela wrote:
>Using a set of checkboxes (associated with country names) would
produce _much_ better usability.

Generally I would agree, but in this case there are over 300 items in
the list. Checkboxes aren't a good alternative when there are that
many items.
I don't think there are that many countries in world, even under a fairly
broad meaning for "country". A list of _areas_ could be arbitrarily long, of
course.

Anyway, if it's too much for a set of checkboxes, it's even stronger too
much for a select list. Imagine yourself scrolling up and down in a list of
300 items, with about a dozen of them visible at a time, trying to
remember what you have already selected and what you wish to select, and
trying to figure out whether you should try to find the United Kingdom under
"B" (Britain), "E" (England) or "G" (Great Britain) or maybe "U".
If the user knows which countries he wants to visit, allowing him
to type them, rather than sort through an exhaustive list to find them
would be better.
And then you could accept all the commonly used synonyms for a country.
There will be input errors, inevitably, that would be avoided in select or
checkbox approaches, though.

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

Aug 22 '07 #7
Jukka K. Korpela wrote:
Scripsit Robert Latest:
>I always love it when I'm looking for a local representative of a
company that has a handful of offices around the world, and the web
droid who did the page crammed every country in existence into a
drop-down list.

... as well as some non-existent countries, such as "Serbia and
Montenegro", and missing some of the existing countries, like "Serbia"
and "Montenegro".
In the United States we have a similar situation, where dropdowns
listing the states and state-equivalents (the District of Columbia,
Puerto Rico, US Virgin Islands, etc.) including nations that were once
under US administration as part of the UN Trust Territory of the Pacific
but that became independent nations years ago. Though I admit I haven't
seen one that includes the Panama Canal Zone.
Aug 22 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
4
by: celerystick | last post by:
This is an xsl question, comp.infosystems.www.authoring.stylesheets were not able to help , here goes .... With one xml file containing repeated element <subject>: ...
11
by: Saqib Ali | last post by:
Please excuse me, this is a fairly involved question that will likely require you to save the file below to a file and open it in a browser. I use Mozilla 1.5, so the problem I describe below...
9
by: Carlis | last post by:
I want to make a program that, when you have the mouse on a word, that word is bold... and when you don't have the mouse on that word, the word is not bold. Excuse me for my poor English :-( But...
4
by: hawat.thufir | last post by:
Just for posterity: $ pwd /home/thufir/xalon/w3school $ whoami thufir $ ll total 24 -rw-rw-r-- 1 thufir thufir 239 Feb 19 09:16 foo.xml
0
by: RYoung | last post by:
Hi all, Hope no one minds this long message, but I'm puzzled: --------------- The following is a shortened version of schema located at...
19
by: zzw8206262001 | last post by:
Hi,I find a way to make javescript more like c++ or pyhon There is the sample code: function Father(self) //every contructor may have "self" argument { self=self?self:this; ...
17
by: rohitchawla | last post by:
i am trying to show and hide a div when onmouseover and onmouseover another div element. i am setting a setTimeout duration on onmouseout to delay the hiding of div for around two second The...
112
by: Prisoner at War | last post by:
Friends, your opinions and advice, please: I have a very simple JavaScript image-swap which works on my end but when uploaded to my host at http://buildit.sitesell.com/sunnyside.html does not...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.