hai using the following array check box in my php script
<input type ="checkbox" name="sel[]" value="<?php echo $b[TempID]; ?>"></div>
its inside the while loop.
for validation iam using javascript code are as :
var d=document.getElementById('div-id');
var dd=d.getElementsByTagName('input');
for (i=0;i<dd.length;i++)
{
var j=dd;
if ( j.type=='checkbox' )
{
if ( j.checked == true )
{
return true;
break;
}
else ( j.checked == false )
{
alert("Pl Select Student to Move ");
return false;
}
}
}
its working but it asking for select everycheck box while its depends on user how many checkbox he can select.....
how to validate array check box in php
Moderator: General Moderators
-
manojsemwal1
- Forum Contributor
- Posts: 217
- Joined: Mon Jun 29, 2009 4:13 am
- Location: India
Re: how to validate array check box in php
Not sure what you are asking. Are you needing it to confirm that at least X boxes are checked instead of confirming whether all boxes are checked?
-
manojsemwal1
- Forum Contributor
- Posts: 217
- Joined: Mon Jun 29, 2009 4:13 am
- Location: India
Re: how to validate array check box in php
yes i need that........
actually it is a list of student and iam using check box to allocate the student to their related center so we have to need select the student and allocate it in the center.
but for that i used to validate the first user select the center name and then select at least one student.
i used the script but in this script if i select a student again its asking for select student.
thanks
actually it is a list of student and iam using check box to allocate the student to their related center so we have to need select the student and allocate it in the center.
but for that i used to validate the first user select the center name and then select at least one student.
i used the script but in this script if i select a student again its asking for select student.
thanks
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Re: how to validate array check box in php
if you edit your post to use code tags, ill help
-
manojsemwal1
- Forum Contributor
- Posts: 217
- Joined: Mon Jun 29, 2009 4:13 am
- Location: India
Re: how to validate array check box in php
Which post do u want to edit..while the code is first post..............on the top