I want to make some error messages in my CodeIgniter. I tried using
$this->form_validation->set_message('is_unique[users.username]', 'The username is already taken');
However, I cannot get it to work.
Editing the form_validation_lang.php file form_validation_lang.php not good enough, since is_unique will be the username already accepted for the username and an email has already been registered for emails.
How can I create this error message?
Here is the code snippet:
$this->form_validation->set_message('is_unique[users.username]', 'The username is already taken'); // Check if username has changed if ($this->input->post('username') !== $user->username) { $this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[4]|max_length[20]|is_unique[users.username]'); }
php validation forms codeigniter
Patrick reck
source share