ZF-12050: formSelect optgroup syntax broken
Description
When creating optgroups, the label is also used as part of the id:
$opt_id = ' id="' . $this->view->escape($id) . '-optgroup-'
. $this->view->escape($opt_value) . '"';
$list[] = '';
This breaks when the label contains spaces or html entities, e.g. "Waren & Fremdleistungen", both spaces and & are not allowed in ids.
Comments
Posted by Frank Brückner (frosch) on 2012-02-10T07:30:02.000+0000
Code tags added.
Posted by Adam Lundrigan (adamlundrigan) on 2012-02-25T17:23:12.000+0000
Confirmed. Label value is not filtered before being used in the optgroup id.
Attached patch which corrects this behavior, according to id element rules found here: http://stackoverflow.com/a/79022
Posted by Adam Lundrigan (adamlundrigan) on 2012-02-25T17:26:55.000+0000
One thing to note is that the label value is escaped before being used in the id, which means {{& -> &}}. Not sure if this is the intended behavior.