making a selection

S

Stijn Goris

hi all,

I have this simple problem:
A user has to choose his 3 favorite numbers from a list of 100 numbers. I
want to show these numbers with some sort of checkbox. How can I create a
groep of checkboxes that are somehow linked in a way the user can only
select maximum 3 numbers?

I hope someone can help me out

thanks
Stijn
 
C

Chris Morris

Stijn Goris said:
A user has to choose his 3 favorite numbers from a list of 100 numbers. I
want to show these numbers with some sort of checkbox. How can I create a
groep of checkboxes that are somehow linked in a way the user can only
select maximum 3 numbers?

I hope someone can help me out

Might be possible in Javascript, with server-side validation in case
JS is disabled.

Possibly better, certainly more reliable, would be to have three
columns of radio buttons.

One A1( ) B1( ) C1( )
Two A2( ) B2( ) C2( )
....
Hundred A100( ) B100( ) C100( )

Doesn't stop people picking the same number twice or three times if
they really like it, though, but it would mean they could only make
one choice per column.
 
J

Jukka K. Korpela

Stijn Goris said:
I have this simple problem:

Even with simple problems, posting the URL is recommendable. It often
helps to suggest an approach that completely avoids the problem.
A user has to choose his 3 favorite numbers from a list of 100
numbers. I want to show these numbers with some sort of checkbox.

That's quite a many numbers to choose from, isn't it? The natural idea is
to include three text input fields and ask the user to type the numbers.
That should normally as convenient as or more convenient than scrolling
down and trying to find the numbers. But this really depends on what is
being selected. Is it really about numbers, or are the numbers just used
to identify some items?
How
can I create a groep of checkboxes that are somehow linked in a way
the user can only select maximum 3 numbers?

You cannot, in HTML. And you don't need to. Just tell the user that he is
expected to select at most three, and make the form handler (server-side)
reject submissions that violate this. You could do that politely, or non-
politely, or silently, depending on your goals.
 

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
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top