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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

johnv’s picture

see attached example.

joelstein’s picture

Status: Active » Needs review
FileSize
609 bytes

Agreed! 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.

johnv’s picture

patch #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.

input.form-text, textarea.form-textarea, select.form-select {border: 1px solid #CCC;}
textarea.form-textarea, select.form-select{ padding: 4px; }

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()

johnv’s picture

Status: Needs review » Needs work
attheshow’s picture

Status: Needs work » Closed (fixed)

#2 patch has been committed to dev. Thanks!

johnv’s picture

Status: Closed (fixed) » Fixed

Thanks 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

windmaomao’s picture

Status: Closed (fixed) » Needs work

i 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.

  • attheshow committed 38fda4d on 8.x-1.x
    #1373820: Minor CSS improvement. Thanks joelstein.