Welcome Guest, Not a member yet? Register   Sign In
Multiselect validation not working
#1

[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?
#2

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




Theme © iAndrew 2016 - Forum software by © MyBB