I tried that and bizarrely it never calls the callback. Is there something special i have to do to ge it to actually do the callback ?
i have in my controller...
$crud->set_rules('email', 'Email','trim|required|valid_email|callback_email_check');
and the callback is...
function email_check($str){
$id = $this->uri->segment(4);
if(!empty($id) && is_numeric($id))
{
$email_old = $this->db->where("id", $id)->get('contacts')->row()->email;
if($str==$email_old)
{
return true;
}
else
{
$query = $this->db->get_where('contacts', array('email' => $str));
if($query->$query->num_rows() > 0)
{
$this->form_validation->set_message('email_check', 'The email already exists');
return false;
}
else
{
return true;
}
}
}
else
{
$query = $this->db->get_where("contacts", array('email' => $str));
if($query->$query->num_rows() > 0)
{
$this->form_validation->set_message('email_check', 'The email already exists');
return false;
}
else
{
return true;
}
}
}
The other things work like required and valid_email. This is driving me insane! I have even made a simple callback that sends me an email but it never sends anything.