Ticket #614 (closed Patch: duplicate)

Opened 6 months ago

Last modified 6 months ago

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.

Attachments

Form-Forge-Multiselect-fix.patch (2.2 kB) - added by beau6183 6 months ago.
Patch file

Change History

Changed 6 months ago by beau6183

Patch file

Changed 6 months ago by Shadowhand

  • status changed from new to closed
  • resolution set to duplicate

Duplicate of #341.

Note: See TracTickets for help on using tickets.