I have a custom callback in my codeigniter validation that is not getting called, I just can't figure out where the error is.
This is my controller:
$this->form_validation->set_error_delimiters('', '');
$this->form_validation->set_rules('pedido', 'numero de pedido', 'trim|required|integer');
$this->form_validation->set_rules('cliente', 'nombre del cliente', 'trim|required|alpha_numeric_spaces');
$this->form_validation->set_rules('motivo', 'motivo de la devolucion', 'trim|required|alpha_numeric_spaces');
$this->form_validation->set_rules('imagen', 'imagen', 'callback_handle_upload');
if ($this->form_validation->run() == FALSE) {
$error_array = array(
'pedido' => form_error('pedido'),
'cliente' => form_error('cliente'),
'motivo' => form_error('motivo'),
'imagen' => form_error('imagen')
);
$this->session->set_userdata('notify', $error_array);
redirect('garantias-y-devoluciones');
die();
}
This is my callback function
public function handle_upload($str)
{
$this->form_validation->set_message('imagen', 'The {field} has an error.');
return FALSE;
}
It should trigger the error but its not.