[eluser]Bramme[/eluser]
Okay, in my form I have a series of checkboxes called categories[] so I can process them as an array in my controller.
However, there's no validation for this in CI 1.6.3 (is there in 1.7? if so, i'm upgrading) so I thought I'd write my own.
Code:
$rules['categories[]'] = 'callback_required_checkbox';
That's in my controller
and in MY_Validation.php I have
Code:
function required_checkbox($str) {
$ci =& get_instance();
$ci->validation->set_message('require_array_checkbox', 'You have to set at least one checkbox');
if( $ci->input->post($str) == '') {
return FALSE;
} else {
return TRUE;
}
}
However, nothing happens. I'd even be happy with an error message, but not even that! Unless I delete a ; offcourse. If I try to echo something in it, nothing happens either...
Can anybody help me out?