Hi guys,
I trying to use callback_before_insert like this:
$crud->callback_before_insert(array($this,'_callback_antes_insercao_validar_data'));
$crud->set_lang_string('insert_error','Data final não pode ser menor que inicial.');
callback:
function _callback_antes_insercao_validar_data($post_array)
{
if ((strtotime($post_array['DATFIM'])) < (strtotime($post_array['DATINI'])))
{
return false;
}
return true;
}
Instead of showing my set_lang_string custom message it shows "An error has been occured at the insert".
At the same way using callback_before_update it works fine as expected.
$crud->callback_before_update(array($this,'_callback_antes_atualizacao_validar_data'));
$crud->set_lang_string('update_error','Data final não pode ser menor que inicial.');
callback:
function _callback_antes_atualizacao_validar_data($post_array, $primary_key)
{
if ((strtotime($post_array['DATFIM'])) < (strtotime($post_array['DATINI'])))
{
return false;
}
return true;
}
Does anyone kwow what I am doing wrong?
How can I show my custom validation message using before insert callback?
Thanks in advance.
