When {html_options} is specified with a name param, it creates a select tag
surrounding the provided options. When it does that, it applies any provided
class not only to the select tag itself, but also to all the options within it.
For example:
{html_options name="options" options=array("1" => "a", "2"=> "b", "3" => "c")
class="form-control"}
What is the expected output?
<select class="form_control" name="options">
<option value="1">a</a>
<option value="2">b</a>
<option value="3">c</a>
</select>
What do you see instead?
<select class="form_control" name="options">
<option class="form_control" value="1">a</a>
<option class="form_control" value="2">b</a>
<option class="form_control" value="3">c</a>
</select>
I know that class is treated blindly (it's just another key-value pair) in this
case, but it means that html_options can't be used for some things, for example
bootstrap's select tags expect the class on the select, but falls to bits if it
is also applied to the options. I think a reasonable approach would be to treat
the class param specially and apply it to the options if the name is not
provided (i.e. and no select tag is generated), but only apply it to the select
if the name is provided.
Original issue reported on code.google.com by marcus.b...@gmail.com on 10 Jul 2014 at 4:17
Original issue reported on code.google.com by
marcus.b...@gmail.com
on 10 Jul 2014 at 4:17