title: Custom error message using CodeIgniter Form Validation
body: <p>I want to make some custom error messages in my CodeIgniter forms. I've tried using</p>
  
  <p><code>$this-&gt;form_validation-&gt;set_message('is_unique[users.username]', 'The username is already taken');</code></p>
  
  <p>However I can't get it working. </p>
  
  <p>Editing the <code>form_validation_lang.php</code> file is not good enough, as <code>is_unique</code> will be <strong>The username is already taken</strong> for usernames, and <strong>The e-mail is already registered</strong> for mails.</p>
  
  <p>How can I make this custom error message?</p>
  
  <p>Here's a snippet from my code:</p>
  
  <pre><code>$this-&gt;form_validation-&gt;set_message('is_unique[users.username]', 'The username is already taken');
  
  // Check if username has changed
  if ($this-&gt;input-&gt;post('username') !== $user-&gt;username) {
      $this-&gt;form_validation-&gt;set_rules('username', 'Username', 'trim|required|min_length[4]|max_length[20]|is_unique[users.username]');
  }
  </code></pre>