I am new to CodeIgniter (v 3.0.0) (comes from CakePHP) and I am trying to set authentication error messages in one of my forms. I use the configuration file to store all my validation rules, as described here . This is my application/config/form_validation.php :
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); $config = array( 'appointments/signup' => array( array( 'field' => 'admin[name]', 'label' => 'Name', 'rules' => 'required', 'errors' => array( 'required' => 'Please tell us your %s', ), ), array( 'field' => 'admin[email]', 'label' => 'Email', 'rules' => 'required|valid_email|is_unique[users.email]', 'errors' => array( 'required' => 'Please enter your %s address', 'valid_email' => 'Please enter a valid email address', 'is_unique' => 'That email is already taken. Forgot your password?' ) ), array( 'field' => 'admin[username]', 'label' => 'Username', 'rules' => 'required|min_length[4]|max_length[25]|is_unique[user_settings.username]', 'errors' => array( 'required' => 'Please choose a %s', 'min_length' => '%s must me at least 4 characters long', 'max_length' => '%s cannot exceen 25 characters', 'is_unique' => '%s is already taken :(' ) ), array( 'field' => 'admin[phone_number]', 'label' => 'Phone number', 'rules' => 'min_length[0]', ), array( 'field' => 'admin[password]', 'label' => 'Password', 'rules' => 'required|min_length[8]', 'errors' => array( 'required' => 'Please choose a %s', 'min_length' => '%s must be at least 8 characters long' ) ), array( 'field' => 'admin[passconf]', 'label' => 'Password', 'rules' => 'required|matches[admin[password]]', 'errors' => array( 'required' => 'Please re-type your %s', 'matches' => '%ss do not match' ) ), array( 'field' => 'company[company_name]', 'label' => 'Organization\ Name', 'rules' => 'required', 'errors' => array( 'required' => 'Please tell us your %s', ) ), ), );
As you can see, I am trying to set a custom reverse validation using the errors array, as described below here . But I still see the default global message The <field name> field is required. .
Is there a way to set custom validation messages in a configuration file without having to edit the default global file?