开发者

multi-selection [combo] boxes

My selection is still a 'popup' style instead of always being open [a box] with the options vertically aligned to the top ie a combo-selection box.

i am using the following code within a fields for block:

 <%= t.select(:teams, thisT,
     {:multiple => true, :size =>5}) %>

where thisT = [[4, "JudysBiz (4)"], [5, "testJ (4)"]]

produces the following html code:

<select id="game_6_teams" name="game[6][teams]">
<option value="4">JudysBiz (4)</op开发者_StackOverflowtion>
<option value="5">testJ (4)</option>
</select>

As you can see, the structure in the html code does not show as a multi-select box. i tried to set the first param as 'teams[]' instead of :teams but the html code came out as:

<select id="game_6_teams[]" name="game[6][teams[]]">
<option value="4">JudysBiz (4)</option>
<option value="5">testJ (4)</option>
</select>

and it still does not show up as a combo-select box... What am I missing?


Try this:

<%= t.select(:teams, thisT, {}, {:multiple => true, :size => 5}) %>

Syntax is as follows:

select(object, method, choices, options = {}, html_options = {})

can be found here:

http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜