php - GroceryCrud validation custom messages -


i have 1 question.. how validate fields data custom error messages? use codeigniter, , grocery crud twitter bootstrap theme, , field required, example:

$crud->set_rules('first_name', 'name', 'required'); or $crud->required_fields('first_name'); 

validation work fine, if validation unsuccessfull - see alert standart message - "an error has occurred on insert\update". how display custom message field required or etc. ? thanks.

although old topic, thing can error me it.

we can't use ci set_message function crocerycrud validation. because crocerycrud use validation object.

you can edit libraries/grocery_crud.php, find line "protected function form_validation()",

at under function, can copy it, rename , edit access modifiler public :

public function get_form_validation(){         if($this->form_validation === null)     {         $this->form_validation = new grocery_crud_form_validation();         $ci = &get_instance();         $ci->load->library('form_validation');         $ci->form_validation = $this->form_validation;     }      return $this->form_validation; } 

now, can call in controller :

 $crud-> get_form_validation()->set_message('check_city',"invail %s"); 

Comments