Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
You would expect that the left and right options-box have the same css-behaviour. They have not.
You can se it very clear in the Seven theme:
- admin/config/people/accounts/fields: add a field to a user, set the multiselect widget;
- user/1/edit;
--the left box has no lines around it.
--the right box is higher.
--the right box has all kinds of margins, padding - the left box not.
Comment | File | Size | Author |
---|---|---|---|
#2 | theme-multiselect-1373820-2.patch | 609 bytes | joelstein |
#1 | multiselect_css_differences_left_right.jpg | 14.94 KB | johnv |
Comments
Comment #1
johnvsee attached example.
Comment #2
joelstein CreditAttribution: joelstein commentedAgreed! Since most installations out-of-the-box use the Seven admin theme for content editing, I think Multiselect should theme the form-multiselect element the same way that Seven themes the form-select box. My guess is that most themers won't go to much trouble to override Seven, just to theme this form element, and if they're using a custom theme for content management, they'll just theme this field to their liking.
Here's a patch which accomplishes this.
Comment #3
johnvpatch #2 helps a bit, but IMO the .module file needs atttention, too.
1. the right box has still the following differences with the left box, according to Chromes element inspector.
2. In IE8, the left box has grey texts when it does not have the focus, and black texts when it has. This is not the case with the right box.
3. With regards to the php-code, the html-source code for the left and right box are very different:
<select name="field_MY_FIELD_unsel" multiple="multiple" class="form-multiselect field_MY_FIELD_unsel multiselect_unsel" id="field_MY_FIELD" size="10">
vs.
<select class="field_MY_FIELD_sel multiselect_sel form-select required" id="field_MY_FIELD" multiple="multiple" name="field_MY_FIELD[und][]" size="10">
- When editing an existing node, the unselected options are not passed through function _multiselect_html_for_box_options().
- It seems there is some strange mix of theme_multiselect($variables) , _multiselect_build_widget_code() and multiselect_field_widget_form()
Comment #4
johnvComment #5
attheshow CreditAttribution: attheshow commented#2 patch has been committed to dev. Thanks!
Comment #6
johnvThanks for committing this.
Setting the status to 'fixed' is enough. It will leave the issue visible in the issue queue for 2 weeks, after which the status is set ot 'closed (fixed)'automatically.
Comment #8
windmaomao CreditAttribution: windmaomao commentedi need to set
'#attributes' => array('size' => 10),
in form to make it work. I compared the Form version and Field version, and found this is the difference.