Grocery CRUD Callback

Asked

Viewed 180 times

-1

I need to set a message to the user, after validating a callback function, however, I do not enter anything related. It has a generic message that serves for the whole form, I want to by fields.

I tried with form_validation->set_message, but it didn’t work.

Thanks if someone knows how to display a custom message, coming from a callback function.

  • Robson, show us the code you’re using and how you’re using Grocery Crud so we can help you.

  • Hello, @Rafaelacioly! So I finally gave up Grocery Crud. I was giving myself more trouble than if I was going to do it. Thank you.

1 answer

0

An example:

 /** CHAMADA REGRA**/
   $this->form_validation->set_rules('campo', 'Label Campo', 'required', ['nome_regra', [$Objeto, 'nome_funcao_valida']]], 
            ['required' => 'Campo obrigatorio.']);


/** FUNCAO QUE VALIDA **/
function nome_funcao_valida($valor)
    {
     if(CONDICAO)
          return true;
    else
    {
       $this->form_validation->set_message('nome_regra', 'A {field} não confere');
                return false;
    }
}
  • Hello, yathal! So I tried this way, but it didn’t work either. Finally, I gave up and I did it all. Thanks!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.