Validating a form, I have set-up a callback on a validation rule. The validation is working properly but for reasons not understood Codeigniter is not returning the error message set in the callback function. Here is the code:
The rule set in the Controller:
PHP Code:
$this->form_validation->set_rules('group_id', 'Group ID', 'callback_group_id_check');
The callback function:
PHP Code:
public function group_id_check($group_id) {
if(!ctype_digit($group_id)) {
$this->form_validation->set_message('group_id', 'Group id is not acceptable.');
return FALSE;
} else {
return TRUE;
}
I have run the code with and without a debugger. The syntax above runs without a problem. If I purposely set 'group_id' with a value that will trigger a false, Codeigniter returns an error message: "Unable to access an error message corresponding to your field name Group ID.(group_id_check)"
I followed the tutorial within Form Validation documentation for CI 3.1.6
Can someone show what I am doing wrong?