I created My_Form_validation class that extends from CI_Form_validation class.
I created a custom method to validate alpha strings with withe spaces, and work properly. But, now i need validate if an id exists in the database.
So i created a method in My_Form_validation to check it, but not work, the validation always return false:
My_Form_validation
class My_Form_validation extends CI_Form_validation { public function get_error_array(){ return $this->_error_array; } public function alpha_space($value){ $str = str_replace(" ", "", $value); return ctype_alpha($str); } public function entity_exist($id){ return true; } } Validation rule
'entity_report' => array( array( 'field' => 'id', 'label' => 'id', 'rules' => 'trim|required|is_natural_no_zero|entity_exist' ) ) Why Codeigniter not catch the validator from the validation class ? I dont want the validator method in a controller.
Any ideas ?