title: Form validation on radio buttons Codeigniter
body: <p>I am trying to add validation for radio buttons on a html form in Codeigniter. The form is prepopulated with data from a database, including a list of uploaded documents (this field may be empty if the item has no associated docs). The user can upload a new document, adding it to the existing docs or adding a new doc deleting the current ones.</p>
  
  <p>So I have a text field containing the org doc names and a file upload field for new: </p>
  
  <pre><code> &lt;label for="orgdocs"&gt;Documents&lt;/label&gt;
   &lt;input type="text" id="orgdocs" readonly="readonly" value="&lt;?php echo $fetched_row['pdocs']; ?&gt;"  /&gt;
   &lt;input type="file" id="newdocs" name="newdocs[]" multiple="multiple" /&gt;
  </code></pre>
  
  <p>and radio buttons: (ignore the bad attempt at Spanish names)</p>
  
  <pre><code> &lt;label for="mas"&gt;&lt;b&gt;Añada mas&lt;/b&gt;&lt;/label&gt;
  &lt;input type="radio" name="docsacion" style="margin-right: 0" &lt;?php if (isset($docsacion) &amp;&amp; $docsacion=="mas") echo "checked";?&gt; value="mas" title="Add another document to existing docs"&gt;&lt;br /&gt;
  &lt;label for="otra"&gt;&lt;b&gt;Borrar y añada otra&lt;/b&gt;&lt;/label&gt;
  &lt;input type="radio" name="docsacion" style="margin-right: 0" &lt;?php if (isset($docsacion) &amp;&amp; $docsacion=="otra") echo "checked";?&gt; value="otra" title="Remove all current docs and add new"&gt;
  </code></pre>
  
  <p>I just want to add validation. IF a new document has been selected(newdocs is not empty), dosacion is required. 
  I have tried: </p>
  
  <pre><code>if(isset($_FILES['newdocs']['name']) &amp;&amp; (!empty($_FILES['newdocs']['name'])))
  {$this-&gt;form_validation-&gt;set_rules('docascion','Documentation upload', 'required');}
  </code></pre>
  
  <p>but this gives the error even if the newdocs field is empty and I´ve no idea why!? </p>