CodeIgniter Forums
Multiselect validation not working - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Multiselect validation not working (/showthread.php?tid=35818)



Multiselect validation not working - El Forum - 11-11-2010

[eluser]Unknown[/eluser]
Even though my multiselect has a default value, the form_validation library still says the field is required. Here's my code:

Code:
// Validation:
$this->form_validation->set_rules('product_category[]', 'Category', 'required');

// Form field:
<tr><td>&lt;?php echo form_label('Category: ', 'product-category') ?&gt;</td><td>&lt;?php echo form_multiselect('product_category[]', array('desktop' => 'Desktop Computers', 'laptop' => 'Laptop Computers', 'mobile' => 'Mobile Devices'), 'desktop', 'id="product-category"') ?&gt;</td></tr>

Am I missing something here?


Multiselect validation not working - El Forum - 11-11-2010

[eluser]Unknown[/eluser]
Nevermind, just a rookie mistake.