⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

CI + HMVC + GROCERY CRUD validation callback not working .



idrezzz

idrezzz
  • profile picture
  • Member

Posted 03 January 2019 - 09:46 AM

I have following code :
 

$state = $this->grocery_crud->getState();

if($state == 'insert_validation'){

    $this->grocery_crud->set_rules('id_thn_ajaran','Thn ajaran','required|is_unique[tahun_ajaran.id_thn_ajaran]');

}elseif($state == 'update_validation'){

    $this->grocery_crud->set_rules('id_thn_ajaran','Thn ajaran','callback_thn_ajaran_check'); 

}

///////

public function thn_ajaran_check($str){

    $this->form_validation->set_message('thn_ajaran_check', 'The Thn ajaran already exists');

    return false;

}

 
The validation callback "callback_thn_ajaran_check" is not called within the function thn_ajaran_check.
But the validation is_unique is run perfectly.
 
can anyone help me, plis.

 


spinburn

spinburn
  • profile picture
  • Member

Posted 06 January 2019 - 21:01 PM

I have the same problem using   grossery 1.6.2

 

it simple cant find the callback'ed function...

 

 

 

$crud->set_rules('marca', 'Marca', 'callback_marcat');

 

...

public function marcat($str)
{
 
  if($str=="ford")
  {
  return true;
  }
  else
  {
  $this->form_validation->set_message('marcat', 'No match');
  return FALSE;
  }
}

 

 

"

error message:           Unable to access an error message corresponding to your field name"