Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. checkbox validation

checkbox validation

Scheduled Pinned Locked Moved ASP.NET
tutorial
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Prakash_Mishra
    wrote on last edited by
    #1

    hi all Can any one tell me how to validate a group check box or check box list, i want user to select atleast one check box before he clicks on submit Thanks

    Prakash Mishra(Banglore,India)

    J S M 3 Replies Last reply
    0
    • P Prakash_Mishra

      hi all Can any one tell me how to validate a group check box or check box list, i want user to select atleast one check box before he clicks on submit Thanks

      Prakash Mishra(Banglore,India)

      J Offline
      J Offline
      John ph
      wrote on last edited by
      #2

      Prakash_Mishra wrote:

      Can any one tell me how to validate a group check box or check box list

      You need to write Client-Side Javascript for CheckBox Validation.

      - Regards -
         JON


      Life is not measured by the amount of breaths we take, but by the moments that take our breath away.


      1 Reply Last reply
      0
      • P Prakash_Mishra

        hi all Can any one tell me how to validate a group check box or check box list, i want user to select atleast one check box before he clicks on submit Thanks

        Prakash Mishra(Banglore,India)

        S Offline
        S Offline
        Sun Rays
        wrote on last edited by
        #3

        Hi, do this. On button's ClientClick Call the function of Javascript. function MyCheckBoxList() { var flag=0; var MyChkLst= document.getElementById ("CheckBoxList ID"); var arrayOfCheckBoxes= MyChkLst.getElementsByTagName("input"); for(counter = 0; counter<arrayOfCheckBoxes.length; counter++) { if (arrayOfCheckBoxes[counter].checked) { flag=1; } else { alert("not checked"); return false; } } if(flag==1) { alert('checked'); return true; } } -- modified at 7:41 Wednesday 21st November, 2007 Thanks, Sun Rays Rate this post if you like answer. My Articles

        P 2 Replies Last reply
        0
        • S Sun Rays

          Hi, do this. On button's ClientClick Call the function of Javascript. function MyCheckBoxList() { var flag=0; var MyChkLst= document.getElementById ("CheckBoxList ID"); var arrayOfCheckBoxes= MyChkLst.getElementsByTagName("input"); for(counter = 0; counter<arrayOfCheckBoxes.length; counter++) { if (arrayOfCheckBoxes[counter].checked) { flag=1; } else { alert("not checked"); return false; } } if(flag==1) { alert('checked'); return true; } } -- modified at 7:41 Wednesday 21st November, 2007 Thanks, Sun Rays Rate this post if you like answer. My Articles

          P Offline
          P Offline
          Prakash_Mishra
          wrote on last edited by
          #4

          for(counter = 0; counter can u pl write the full code for this line its missing there Thanks

          Prakash Mishra(Banglore,India)

          1 Reply Last reply
          0
          • P Prakash_Mishra

            hi all Can any one tell me how to validate a group check box or check box list, i want user to select atleast one check box before he clicks on submit Thanks

            Prakash Mishra(Banglore,India)

            M Offline
            M Offline
            mykosher
            wrote on last edited by
            #5

            Hi,:) you can do that using javascript . call one common function on each and every checkbox checked and set one flag value in hidden field and check this flag when you submit. function CallMe(id) { if(document.getElementByID(id).chekced==true) { //set hidden field value to true } else { //set hidden field value to false } } :-D -- modified at 7:33 Wednesday 21st November, 2007

            1 Reply Last reply
            0
            • S Sun Rays

              Hi, do this. On button's ClientClick Call the function of Javascript. function MyCheckBoxList() { var flag=0; var MyChkLst= document.getElementById ("CheckBoxList ID"); var arrayOfCheckBoxes= MyChkLst.getElementsByTagName("input"); for(counter = 0; counter<arrayOfCheckBoxes.length; counter++) { if (arrayOfCheckBoxes[counter].checked) { flag=1; } else { alert("not checked"); return false; } } if(flag==1) { alert('checked'); return true; } } -- modified at 7:41 Wednesday 21st November, 2007 Thanks, Sun Rays Rate this post if you like answer. My Articles

              P Offline
              P Offline
              Prakash_Mishra
              wrote on last edited by
              #6

              Thanks a lot

              Prakash Mishra(Banglore,India)

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups