set_value() in a form_multiselect() |
[eluser]jamesf[/eluser]
Using version 2.0.2 when trying to re-populate a multiselect form I only ever get one value returned. Looking at the Form_validation.php class this is the default action for any value that's an array: Code: // If the data is an array output them one at a time. Surely this is a bug as currently there's no way to use this to re-populate a multiselect form input. For example this is being returned: Code: 1 Instead of this: Code: Array Any reason why this is the case?
[eluser]Aken[/eluser]
First, set_value() is not meant to use with drop downs. Second, most of the set_value()-type functions are meant to use specifically with each individual value. They're not meant to handle arrays of selected elements. It's true that there should be some additional functionality specifically meant for generating and handling multiselect elements (drop downs, check boxes, etc). In the meantime, this little hack works: Code: form_multiselect('items[]', $options_array, $this->input->post('items')); In the meantime, maybe file a Feature Request on the Bit Bucket CI Reactor page: https://bitbucket.org/ellislab/codeignit...tor/issues
|
Welcome Guest, Not a member yet? Register Sign In |