Welcome Guest, Not a member yet? Register   Sign In
Codeigniter custom validation rules in model
#5

@dbui

I use the same approach, a callback wrapper within the controller with a tiny difference (tried on CI3):

Code:
$this->form_validation->set_rules('email', "email",'callback_validate_user');

In my code it would be:

Code:
$this->form_validation->set_rules('email', "email",'callback__validate_user');

And:

Code:
public function validate_user($str) {

would be:

Code:
public function _validate_user($str) {

Ugly a little bit, but this prefixed with "_" callback rule can not be called by the router.
Reply


Messages In This Thread
RE: Codeigniter custom validation rules in model - by ivantcholakov - 01-09-2015, 12:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB