title: Codeigniter form validation error message
body: <p>I have a form on my website header where i allow the user to log in with his username/password... then i POST to /signin page and check if the username exists to allow the user to log in.. if there is a problem upon login i output these errors...</p>
  
  <p>i tried using the following code to show a custom error but with no luck</p>
  
  <pre><code>    if ($this-&gt;form_validation-&gt;run() == false){
          $this-&gt;load-&gt;view("login/index", $data);
      }else{
          $return = $this-&gt;_submitLogin();
          if ($return == true){
              //success
          }else{
              $this-&gt;form_validation-&gt;set_message('new_error', 'error goes here');
              //error
          }
          $this-&gt;load-&gt;view("login/index", $data);
      }
  </code></pre>
  
  <p>how does set_message work and if this is the wrong method, which one allow me to show a custom error in this case?</p>
  
  <p><strong>EDIT :</strong></p>
  
  <p>validation rules:</p>
  
  <pre><code>private $validation_rules = array(
      array(
          'field'   =&gt; 'username',
          'label'   =&gt; 'Username',
          'rules'   =&gt; 'trim|required|callback__check_valid_username|min_length[6]|max_length[20]|xss_clean'
      ),
      array(
          'field'   =&gt; 'password',
          'label'   =&gt; 'Password',
          'rules'   =&gt; 'trim|required|min_length[6]|max_length[32]'
      ),
  );
  </code></pre>