Jump to content


CI + HMVC + GROCERY CRUD validation callback not working .

hmvc validation

  • Please log in to reply
1 reply to this topic

#1 idrezzz

idrezzz

    Newbie

  • Members
  • Pip
  • 1 posts

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.

 



#2 spinburn

spinburn

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 06 January 2019 - 09: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"







Also tagged with one or more of these keywords: hmvc, validation

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users