checkbox validation help needed

#1
[eluser]Computerzworld[/eluser]
Hello. I am having 7 checkboxes with 7 different names. I want that atleast one checkbox should be checked using CI validation. How can I do it? Plz help me. Thanks in advance.

#2
[eluser]MASS MASS[/eluser]
you do like this.......

<input type="checkbox" name="chked[]" value = "1">
<input type="checkbox" name="chked[]" value = "2">

in validation

$rules['chked'] = "required"

and

$field['chked'] = "Check field"

#3
[eluser]Dan Murfitt[/eluser]
Thanks for posting this, it seems to work well. How would you reference the default value with this? For example:

Code:
echo $this->validation->set_checkbox('chked[]', '1')

Thanks for your help.
Dan

#4
[eluser]Dan Murfitt[/eluser]
[quote author="Dan Murfitt" date="1218742890"]Thanks for posting this, it seems to work well. How would you reference the default value with this? For example:

Code:
echo $this->validation->set_checkbox('chked[]', '1')

Thanks for your help.
Dan[/quote]

Just found a thread with a working solution to this...
http://ellislab.com/forums/viewthread/73012/
Thanks


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.