I’m using the form::select helper in Kohana 3.2 to generate a select input with the following code (formatted for display here):
form::select('id_plyta', $plyta, $plyta_selected,
array('style' => 'width:300px', 'class' => 'sock_depend'));
This code generates the following HTML (formatted for display here):
<select name="id_plyta" class="sock_depend" style="width:300px"
multiple="multiple">
...
</select>
The problem is that it is outputting with an extra multiple="multiple" attribute in the HTML. I don’t want that to be a part of it.
If I put a NULL instead of $plyta_selected then it works fine.
How do I get rid of multiple="multiple" and why is it even there?
When you check out the list of parameters it accepts, pay attention to the third:
When sending the paramters to the
selectmethod of theFormclass, if the third parameter is an array, the helper will automatically include themultiple="multiple"to allow it to pre-select more than one option in the drop down select.If you only send a string value, then it will not create a multibox, will not include the
multipleHTML input attribute and it will only pre-select the single value.