detecting same item selected again in a dropdown box

A

Andy Fish

Hi,

Part of my web form allows the user to select their favourite color (well it
doesn't but it's a good example).

There is a dropdown box with red, green, blue, and custom. When they click
custom, a pop-up window allows them to select from other colors. This is
done by an onclick event on the <select> element. So far so good.

But what if they have selected a custom color and then want to change it?.
If they drop the selector down again and re-select custom, the event doesn't
fire again so the window doesn't pop up.

I know it's wrong to take an action on the user selecting an item from a
select control, but I am very tight for space on the form and I can't afford
to put any other controls on.

FWIW My best solution so far is to have 'custom' at the top and 'custom...'
at the bottom. When they select the bottom one, it pops up the window and
selects the top one.

TIA

Andy
 
C

Csaba Gabor

Andy said:
There is a dropdown box with red, green, blue, and custom. When they click
custom, a pop-up window allows them to select from other colors. This is
done by an onclick event on the <select> element. So far so good.

But what if they have selected a custom color and then want to change it?.
If they drop the selector down again and re-select custom, the event doesn't
fire again so the window doesn't pop up.

An idea for you:
Have the top item be: "select a color" (with a label of something like
"Color selection:")
When the user selects a color, you replace that top item with:
"colorName selected" and set the selectedIndex to 0. Thus, custom (not
to mention red, green, blue) are never selected (except transiently -
you may need to do a window.setTimeout, I forget). Plus, this way the
user can even see what custom color they selected.

Csaba Gabor from Vienna
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top