Ticket #614 (closed Patch: duplicate)
form::dropdown doesn't name properly with mutiple-enabled select elements
| Reported by: | beau6183 | Owned by: | Shadowhand |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.1.2 |
| Component: | Modules:Forge | Version: | SVN HEAD |
| Keywords: | multiple select dropdown | Cc: |
Description
In php, to obtain multiple values from a <select multiple="multiple"> control, you have to name it as an array.
I'd expect:
$form = new Forge(); $form->dropdown('mydropdown')->multiple("multiple")->size(5); $form->html();
to output:
<form>
<select name="mydropdown[]" mutiple="multiple" />
</form>
But the array indicator is dropped, making it impossible to pull all selected values from the form post.
I've created a patch to get this working correctly with no interface change (other than setting the multiple attribute on the dropdown).
A note about usage: $selected is now expected to be an array. If it's not an array, the values will be wrapped as an array.
