title: Handling individual form validation errors in codeigniter
body: <p>How to check for Form validation error for an individual element in codeigniter ?</p>
  
  <p>I need to set 'has-error' class to the elements which failed the validation.
  This is not about printing validation errors.</p>
  
  <p>This is what I currently have :</p>
  
  <pre><code>&lt;div class="form-group &lt;?php /**if validation error for this element then*/ echo 'has-error'; ?&gt;"&gt;
      &lt;label for="name"&gt;Name&lt;/label&gt;
      &lt;div class="validation-error"&gt;
          &lt;?php echo form_error ( 'name' ); ?&gt;
      &lt;/div&gt;
      &lt;div class="input-group"&gt;
          &lt;div class="input-group-addon"&gt;&lt;span class="glyphicon glyphicon-user" aria-hidden="true"&gt;&lt;/span&gt;&lt;/div&gt;
          &lt;input id="name" type="text" class="form-control validate" name="name" placeholder="Your full name" value="&lt;?php echo set_value('name'); ?&gt;"&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>