Problem/Motivation

When an optgroup has a space in its label, clicking on its tab in improved multi select causes a JS syntax error from line 65 of improved_multi_select.js. This can be seen by using a list of nodes, with the optgroups being content types. The improved multi select works if the optgroups are the machine names (no spaces), but when using the human readable content type names (which may contain spaces) the error happens.

Proposed resolution

The click event on the optgroup uses $group.text() in a jQuery selector, like '[group!=' + $group.text() + ']' and it's not quoted. Adding double quotes on both sides of the text resolves the problem.

Remaining tasks

Review needed.

Comments

davidbarbarisi@gmail.com’s picture

StatusFileSize
new773 bytes
davidbarbarisi@gmail.com’s picture

Status: Active » Needs review
stupiddingo’s picture

Status: Needs review » Reviewed & tested by the community

I was seeing the same behavior. OptGroups with spaces were causing a full postback. This patch resolves the error.

  • dbarbar authored babb00e on 7.x-2.x
    Issue #2139433: Optgroups with spaces in the label causes a JS syntax...
dmitrii’s picture

Status: Reviewed & tested by the community » Fixed

Thanks.
Comminted.

Status: Fixed » Closed (fixed)

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