making a selection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stijn Goris

    making a selection

    hi all,

    I have this simple problem:
    A user has to select 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


  • Matt Kruse

    #2
    Re: making a selection

    "Stijn Goris" <mepisto@hotmai l.com> wrote:[color=blue]
    > How can I create a
    > groep of checkboxes that are somehow linked in a way the user can only
    > select maximum 3 numbers?[/color]

    I have a reusable library called "CheckboxGr oup" which will do exactly this.
    You can assign all the checkboxes to a group, and then limit the number of
    boxes that can be checked. If you try to check more than the limit, it will
    alert a message and not allow you to do so.


    Be aware, though, that you should also validate this on the server-side,
    too, because someone may disable javascript in their browser and then be
    able to pick as many as they want.

    --
    Matt Kruse
    Javascript Toolbox: http://www.mattkruse.com/javascript/


    Comment

    • Stijn Goris

      #3
      Re: making a selection


      "Matt Kruse" <newsgroups@mat tkruse.com> wrote in message
      news:c6tg3i02ec f@news4.newsguy .com...[color=blue]
      > "Stijn Goris" <mepisto@hotmai l.com> wrote:[color=green]
      > > How can I create a
      > > groep of checkboxes that are somehow linked in a way the user can only
      > > select maximum 3 numbers?[/color]
      >
      > I have a reusable library called "CheckboxGr oup" which will do exactly[/color]
      this.[color=blue]
      > You can assign all the checkboxes to a group, and then limit the number of
      > boxes that can be checked. If you try to check more than the limit, it[/color]
      will[color=blue]
      > alert a message and not allow you to do so.
      > http://www.mattkruse.com/javascript/checkboxgroup/
      >
      > Be aware, though, that you should also validate this on the server-side,
      > too, because someone may disable javascript in their browser and then be
      > able to pick as many as they want.
      >
      > --
      > Matt Kruse
      > Javascript Toolbox: http://www.mattkruse.com/javascript/
      >
      >[/color]

      This is indeed the stuff I need. Although it would be better I think if a
      box is unchecked when the user checks another (fourth) box instead of giving
      him a warning


      Comment

      • Matt Kruse

        #4
        Re: making a selection

        "Stijn Goris" <mepisto@hotmai l.com> wrote:[color=blue]
        > This is indeed the stuff I need. Although it would be better I think if a
        > box is unchecked when the user checks another (fourth) box instead of[/color]
        giving[color=blue]
        > him a warning[/color]

        How would you know which box to uncheck?

        --
        Matt Kruse
        Javascript Toolbox: http://www.mattkruse.com/javascript/


        Comment

        Working...