SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru Raskolnikov's Avatar
    Join Date
    Jul 2003
    Location
    USA
    Posts
    606
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Restricting # of ChkBoxes checked in multiple columns

    I will have 5 columns of data for users to choose from. Each column will have 10 options, with checkboxes next to eachone. the user must select no more and no less than 2 checkboxes from each column. a total of 10 checked (2 from each column)

    this is a .net 2 website, but think JS is the way to go for this issue.

    I have found some solutions for restricting the number of boxes checked within a single list of data within a page, but not with multiple columns of data.

    any ideas or suggestions would be great.

  2. #2
    SitePoint Evangelist bals28mjk's Avatar
    Join Date
    Aug 2007
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's the same deal; run the checkboxes through a loop and make sure two are selected for validation. JS only works on the client, I'd validate with asp too.

  3. #3
    Google Engineer polvero's Avatar
    Join Date
    Oct 2003
    Location
    Mountain View
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here, I whipped this up.
    http://www.dustindiaz.com/basement/checked-columns.html

    If you want to change the limit, simply change the limit number that is passed into 'applyCheckLimit'. Also, be sure to read the code carefully so you know what's going on and can tweak it to your own needs. Cheers

  4. #4
    SitePoint Guru Raskolnikov's Avatar
    Join Date
    Jul 2003
    Location
    USA
    Posts
    606
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    polvero, that works pretty slick thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •