I'm working with Codeigniter 2.2.5 and PHP 5.6
I want to validate the user input with the codeiginter functions. This is the normal way:
$this->form_validation->set_rules('mail', 'E-Mail', 'required|trim|xss_clean|strip_tags');
Here I would like to add a function that checks whether the e-mail address is contained in a defined list.
There is a callback function for custom rules, but this only works in the controller class. I'm in a third party library class.
Like
$this->form_validation->set_rules('username', 'Username', 'callback_username_check');
Does anybody have an idea on how to achieve this with CodeIgniter 2 or do I have to check it on my own and create a custom error message?
I know that in CodeIgniter 3 there are new functionalities, but unfortunately, I have to work with CodeIgniter 2.