Postponed (maintainer needs more info)
Project:
Multiselect
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Jul 2011 at 17:27 UTC
Updated:
11 May 2026 at 12:12 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
erik2e commentedSame problem here. Multiselect does not work within a fieldset.
No time to dig the problem further, but I think it's related to [ and ] added in the field name. The field name is used for CSS/JS that make the widget works, and [] might not help at all :)
A quick & (very) dirty str_replace in the module code to get rid of the [] make things works.
If someone has time to look at it, I'll be glad to help. If not, I'll post here if I can find a good solution to this.
Comment #2
asherry commentedI had this problem as well, and it seemed like it really was the ID's used. I'm not sure why field_name was used for all of the ids, and in the patch I made changing the field_name didn't change any of the form submissions at all.
Hasn't yet been tested with cck fields but works for FAPI usage.
This is my first patch I hope I uploaded it right.
Comment #3
asherry commentedComment #4
pelicani commentedI applied the above path and was able to alter a ecommerce product reference field to use multiselect.
Thank you for the submission asherry!
peace,
michael
Comment #5
pelicani commentedwith the above patch, when you view a cck multiselect, the ids to not get set correctly.
they are blank.
I modified the above patch with a condition to check for the #id in the element and default to the original name used in this module.
See attached.
Comment #6
kaidjohnson commentedThere were some related issues to this issue, namely http://drupal.org/node/1585694 (Multiple multiselects have conflict). This patch re-rolls #5 and fixes 1585694.
Comment #7
alexweber commented@kaidjohnson thanks for the great work! Unfortunately I couldn't get the patch to apply, please re-roll against dev! Thanks!
Comment #8
kaidjohnson commentedNo problem - rerolled. I also added a few comments to clarify some of the changes/updates.
Comment #9
alexweber commentedThanks @kaidjohnson, I'll take a look tomorrow morning and hopefully commit it :)
Comment #10
alexweber commented@kaidjohnson, the patch applies fine but it introduces some weird behavior: the multiselect widget is now automatically populated with all options and none of them can be removed.
Comment #11
kaidjohnson commentedYes, I do see that now. It works in a multiple, nested instance, but not in a singular instance. After playing around with a few things, I have noticed a few issues come up with recent updates that are related to the issue you are seeing.
1) The new way in including the css and js as #attached seems to work for the field api but not for the form api. My programmatically created multiselect fields fail to include the css and js when using #attached, but the fields I created through the field api look and work as expected with this method. Reverting back to the previous drupal_add_css/js works for both instances. This issue began with commit 8eef5b6.
2) The addition of the #after_build workaround causes the code to completely bypass theme_multiselect. Try commenting out the #after_build on line 127 of multiselect.module and try your multiselect field again (with the proposed patch I included above) and you should see it working as expected. To further test this, add a die() to theme_multiselect and re-enable the #after_build. Neither of my test fields killed the page - comment out #after_build, and boom, dead as expected. This issue began with commit 8e8bedc. I recommend investigating an alternate solution for this patch to maintain the current render flow.
At the present time, I'm hesitant to work on re-rolling my patch above as I expect the base code will need a revision to correct the reversions mentioned.
-- UPDATE --
The css/js issue is because the form api does not appear to call multiselect_field_widget_form(), which also explains why my multiple, nested test fields aren't affected by the issue you've documented above - the form api is using theme_multiselect; the field api is using #after_build. Hope that helps...
-- END UPDATE --
Comment #12
alexweber commentedThanks @kaidjohnson for taking the time to look into this. I'll take some time over the next few days to figure out the two issues you pointed out and I'll post back here soon :)
Comment #13
alexweber commentedUnfortunately I just haven't had the time. Patches welcome as usual, thanks!
Comment #14
johnvTry using hook_element_info
Comment #15
mitchalbert commentedany news on this issue? using multiselect 7.x-1.10
Comment #16
sultancillo commentedThis patch solves the multiple multiselects for me (with field api on a "Modify entity values" screen from Views Bulk Operations) i don't have a good test case for FAPI which uses theme_multiselect
Comment #17
thomscode commentedRe-rolling this patch to work with composer.
Comment #18
mparker17multiselect-7.x-1.x is no longer supported, because Drupal 7 is no longer supported.
Can you confirm if this is still an issue in multiselect-2.0.0-beta4?
I'm going to mark this issue as "Postponed (maintainer needs more info)"... but when you answer, please change it back to "Active". If there is no reply in ~6 months, then I will mark this issue as "Closed (outdated)". Thank you in advance for your understanding and patience as I try to keep this module's issue queue clear.