Closed (cannot reproduce)
Project:
Drupal core
Version:
9.3.x-dev
Component:
forms system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
5 Apr 2011 at 23:21 UTC
Updated:
2 Apr 2022 at 01:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
_randy commentedAttaching a patch for this issue. Apologies if this issue has been raised before and/or patched. I couldn't find it.
Comment #2
_randy commentedPatch above works fine to make everything multiple...
Probably best to ignore this, change the documentation to match that the #multiple can only be used in the #attributes array.
Comment #3
wjaspers commentedWhy'd you close this?
Didn't #multiple adjust the #name attribute so that when the field is processed, each value is captured, instead of just one?
Comment #4
asimmonds commented@_randy:
multiple is added to the #attributes array by form_process_select()
A select element has form_process_select() as a #process function, this is called by form_builder() as the form is built, see modules/system/system.module:424 for the form element declaration.
Comment #5
wjaspers commentedI'm puzzled then. That's what its supposed to do, but it presently doesn't or something is overriding it.
Here's what's at line 424 of modules/system/system.module. The
#multipledefault is still present in 7.And here's what's in includes/form.inc around form_process_select();
It looks as if
$element['#multiple']is interpreted as expected ...As far as I can see, your patch would have been correct...and should be applied. Therefore, I'm re-activating this issue.
Comment #6
_randy commented@wjaspers -- problem was that my patch (as simple as it is) breaks all non-multiple select lists when applied. It makes everything multiple.
It could be expanded on by unsetting/altering the right attribute in the form_process_select function to fix the everything-is-multiple issue.
I got around the problem by using #multiple (to get the [] name attribute change), then used
#atrributes => array('multiple' ...) to set the multiple attribute on the element itself.
I figured this boiled down to more of a documentation clarification issue vs. anything else....
Comment #7
wjaspers commentedI guess I misunderstood the function call surrounding your change. I had mistakenly assumed it was a filter,
With that said, it looks like there was a significant change (or just missed) code in that function.
Here's what's in D6.
I'd generate a patch, but I don't know D7's internals well enough to say that simply porting D6's code would be accurate.
Comment #8
wjaspers commentedThis seems to accomplish the trick!
Comment #10
wjaspers commentedLets try this again, apparently my line endings were still in Windows format.
Comment #12
wjaspers commentedHere's exactly how I fixed up theme_select(). If the attached patch doesn't work this time around, could someone please generate one that works correctly?
Comment #13
wjaspers commentedHuh, latest Core -dev seems to be ok now.theme_selecthasn't changed any. I'm not sure whether to change the status of or close this thread.Seems to have risen again in 7.2.
Comment #14
andypostIs this still an issue?
Comment #15
thomas.fleming commentedThis issue still seems to be relevant in Drupal 8. The #multiple default is still present, and form_process_select is relatively unchanged. With that said, I rerolled the latest patch for D8.
Comment #28
quietone commented@_randy, Thank you for reporting this problem. We rely on issue reports like this to improve Drupal core.
I tested this on Drupal 9.4.x, standard install. I used the form_api_example of the Examples module which includes a demo of #select.
And it work as expected.
Therefore, closing as cannot reproduce. If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").
Thanks!