title: codeigniter validation error with field "required"
body: <p>i have a problem with the validation form. It does not work if i put "required", example:</p>
  
  <p>controller:</p>
  
  <pre><code>public function updateBenefit(){
      $result = array();
      $this-&gt;load-&gt;helper(array('form', 'url'));
      $this-&gt;load-&gt;library('form_validation');
  
      $this-&gt;form_validation-&gt;set_rules('beneficio', 'Nombre del Beneficio', 'required|alpha');
      $this-&gt;form_validation-&gt;set_rules('info', 'Info', 'alpha');
      $this-&gt;form_validation-&gt;set_rules('descrip', 'Descripción', 'alpha');
      $this-&gt;form_validation-&gt;set_rules('orden', 'Orden', 'integer');
  
      // $this-&gt;form_validation-&gt;set_rules('fecha', 'Fecha', 'date_valid');
  
      $this-&gt;form_validation-&gt;set_message('required', 'El campo %s es requerido');
  
      if ($this-&gt;form_validation-&gt;run() == TRUE){
  
          if (isset($_POST['id'])){
  
              $idb = $_POST['id'];
              $benefit = BeneficiosManager::getInstance()-&gt;getHome($idb);
  
              $result['message'] = "Se ha modificado el Beneficio con éxito"; 
  
          } else{
              $benefit = BeneficiosManager::getInstance()-&gt;create();
  
              $result['message'] = "Se ha cargado el Beneficio con éxito"; 
          }
  
          $benefit-&gt;nombre = ucfirst(strtolower($_POST['beneficio']));
          $benefit-&gt;content = ucfirst(strtolower($_POST['descrip']));
          $benefit-&gt;intro = ucfirst(strtolower($_POST['info']));
          $benefit-&gt;active = $_POST['optionsRadios2'];
          $benefit-&gt;orden = $_POST['orden'];
  
          // $benefit-&gt;date = $_POST['fecha'];
  
          BeneficiosManager::getInstance()-&gt;save($benefit);
  
          }else{
              //no se validaron los datos ingresados
              $result['message'] = "Error validación";
          }
  
          echo json_encode($result);
  }
  </code></pre>
  
  <p>view:</p>
  
  <pre><code>    {extends file='admin/base/base.tpl'}
  
  {block name='content'}
  
  &lt;h3&gt;Cargar Beneficio &lt;/h3&gt;
  &lt;/br&gt;
  &lt;form action="{site_url()}admin/updateBenefit" class="form-horizontal" method="post" id="" enctype="multipart/form-data"&gt;
  
     &lt;div class="control-group"&gt;
        &lt;label class="control-label"&gt;Beneficio&lt;/label&gt;
        &lt;div class="controls"&gt;
           &lt;input type="text" name="beneficio" value="" class="m-wrap medium" /&gt;
           &lt;span class="help-inline"&gt;Nombre del Beneficio&lt;/span&gt;
        &lt;/div&gt;
     &lt;/div&gt;
  
     &lt;div class="control-group"&gt;
        &lt;label class="control-label"&gt;Info&lt;/label&gt;
        &lt;div class="controls"&gt;
           &lt;textarea name="info" class="medium m-wrap" rows="3"&gt;&lt;/textarea&gt;
           &lt;span class="help-inline"&gt;Información Clave&lt;/span&gt;
        &lt;/div&gt;
     &lt;/div&gt;
  
     &lt;div class="control-group"&gt;
        &lt;label class="control-label"&gt;Descripción&lt;/label&gt;
        &lt;div class="controls"&gt;
           &lt;textarea name="descrip" class="large m-wrap" rows="3"&gt;&lt;/textarea&gt;
           &lt;span class="help-inline"&gt;Descripción del Beneficio&lt;/span&gt;
        &lt;/div&gt;
     &lt;/div&gt;
  
     &lt;div class="control-group"&gt;
        &lt;label class="control-label"&gt;Activo&lt;/label&gt;
        &lt;div class="controls"&gt;
              &lt;label class="radio line"&gt;
                 &lt;input type="radio" name="optionsRadios2" value="1"/&gt;Si&lt;/input&gt;
              &lt;/label&gt;
              &lt;label class="radio line"&gt;   
                 &lt;input type="radio" name="optionsRadios2" value="0"/&gt;No&lt;/input&gt;
              &lt;/label&gt;
           &lt;span class="help-inline"&gt;Ofrecer Beneficio&lt;/span&gt;
        &lt;/div&gt;
     &lt;/div&gt;
  
     &lt;div class="control-group"&gt;
        &lt;label class="control-label"&gt;Orden&lt;/label&gt;
        &lt;div class="controls"&gt;
           &lt;input type="text" name="orden" value="" class="m-wrap small" /&gt;
           &lt;span class="help-inline"&gt;Prioridad del Beneficio&lt;/span&gt;
        &lt;/div&gt;
     &lt;/div&gt;
  
     &lt;div class="control-group"&gt;
        &lt;label class="control-label"&gt;Fecha&lt;/label&gt;
        &lt;div class="controls"&gt;
           &lt;input type="text" name="fecha" value="{$smarty.now|date_format}" class="m-wrap medium" /&gt;
           &lt;span class="help-inline"&gt;&lt;/span&gt;
        &lt;/div&gt;
     &lt;/div&gt;   
  
     &lt;div class="form-actions"&gt;
        &lt;button type="submit" class="btn blue"&gt;&lt;i class="icon-ok"&gt;&lt;/i&gt; Guardar&lt;/button&gt;
        &lt;button type="button" class="btn"&gt;Cancelar&lt;/button&gt;
     &lt;/div&gt;
  
  &lt;/form&gt;
  
  {/block}
  </code></pre>
  
  <p>what might the problem be?</p>
  
  <p>if i remove the "required" field, the form validates... but if i put it, it doesn't... i don't know what else to try, can't understand why this is happening</p>
  
  <p>the code is working now, thanks to @Jonathan that corrected me, and i was also making an imput mistake when i was trying this method. I was trying to put two words in the same field (i.e: bon vivir); so the correct input would be: bonvivir.</p>