kcu*_*tin 8 forms ruby-on-rails form-for acts-as-taggable-on
我无法找出使用多选字段的预定选项集的正确代码.我希望在用户可以选择的下拉列表中列出技能列表.这是我正在使用的代码,它可以作为单个选择字段正常工作,但不能作为多选:
<%= form_for(@user, :html => { :class => "form-stacked" } ) do |f| %>
...
<div class="clearfix"><%= f.select :skill_list, options_for_select(["Asst", "dir", "pres"]),
{
:multiple => true,
:class => "chzn-select",
:style => "width:450px;" } %></div>
...
<% end %>
Run Code Online (Sandbox Code Playgroud)
有人有什么建议吗?最终,我想在其他地方存储多选表单的所有选项,因为会有一堆,但这是我无法弄清楚的第一个挑战..
谢谢.
编辑
我也尝试过:
:html => { :multiple => true, :class => "chzn-select", :style => "width:450px;" } and it doesnt work either
Run Code Online (Sandbox Code Playgroud)
Bat*_*ins 29
需要有两对括号,一对用于options
,一对用于html_options
,如下:
<%= f.select :skills_list, options_for_select(["Asst", "dir", "pres"]), {}, {:multiple => true, :class => "chzn-select", :style => "width:450px;" } %>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
22073 次 |
最近记录: |