checkbox validation
-
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)
-
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)
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.
-
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)
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
-
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
for(counter = 0; counter can u pl write the full code for this line its missing there Thanks
Prakash Mishra(Banglore,India)
-
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)
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
-
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
Thanks a lot
Prakash Mishra(Banglore,India)