December 2013
Intermediate to advanced
306 pages
6h 26m
English
Callbacks are used when you want to validate data in a way that may not be supported by the CodeIgniter's validation class. The benefit of using callbacks is that posted data can be easily validated by a custom function you define, and errors, if any, are passed into the error reporting functions.
We're going to amend the file:
/path/to/codeigniter/application/controllers/form.php Amend that file to show the following:
$this->form_validation->set_rules('first_name', 'First Name', 'required|min_length[1]|max_length[125]'); $this->form_validation->set_rules('last_name', 'Last Name', 'required|min_length[1]|max_length[125]'); $this->form_validation->set_rules('email', 'Email', 'required|min_length[1]|max_length[255]|valid_email|callback_email_check'); ...Read now
Unlock full access