sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
mcha226@gmail.com's Avatar

Have a very long select element repeated


Question posted by: mcha226@gmail.com (Guest) on August 22nd, 2007 06:05 AM
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

7 Answers Posted
Jukka K. Korpela's Avatar
Jukka K. Korpela August 22nd, 2007 06:55 AM
Guest - n/a Posts
#2: Re: Have a very long select element repeated

Scripsit Join Bytes!:
Quote:
Originally Posted by
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.
Quote:
Originally Posted by
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/

Robert Latest's Avatar
Guest - n/a Posts
#3: Re: Have a very long select element repeated

Jukka K. Korpela wrote:
Quote:
Originally Posted by
Scripsit Join Bytes!:
>
Quote:
Originally Posted by
>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.


[...]
Quote:
Originally Posted by
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
Jukka K. Korpela's Avatar
Jukka K. Korpela August 22nd, 2007 01:25 PM
Guest - n/a Posts
#4: Re: Have a very long select element repeated

Scripsit Robert Latest:
Quote:
Originally Posted by
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/

André Gillibert's Avatar
André Gillibert August 22nd, 2007 01:35 PM
Guest - n/a Posts
#5: Re: Have a very long select element repeated

Robert Latest wrote:
Quote:
Originally Posted by
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 <tabkanDELETETHISnaz@yahoDELETETHATo.fr>
Scott Bryce's Avatar
Guest - n/a Posts
#6: Re: Have a very long select element repeated

Jukka K. Korpela wrote:
Quote:
Originally Posted by
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.
Quote:
Originally Posted by
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.
Jukka K. Korpela's Avatar
Jukka K. Korpela August 22nd, 2007 02:45 PM
Guest - n/a Posts
#7: Re: Have a very long select element repeated

Scripsit Scott Bryce:
Quote:
Originally Posted by
Jukka K. Korpela wrote:
>
Quote:
Originally Posted by
>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
Quote:
Originally Posted by
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".
Quote:
Originally Posted by
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/

Harlan Messinger's Avatar
Harlan Messinger August 22nd, 2007 08:25 PM
Guest - n/a Posts
#8: Re: Have a very long select element repeated

Jukka K. Korpela wrote:
Quote:
Originally Posted by
Scripsit Robert Latest:
>
Quote:
Originally Posted by
>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.
 
Not the answer you were looking for? Post your question . . .
197,040 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 197,040 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors