【问题标题】:how to specify label for select in simpleform rails如何在simpleform rails中为选择指定标签
【发布时间】:2011-03-09 06:45:27
【问题描述】:
<%= f.association :opportunity_status, :label => "Status", :input_html => {} %>
<%= f.select :source_type, options_for_select(["lead","vteam"],["lead"]) %>

在第一行,一切正常。在第二行,如果我按照第一行的方式附加标签,则会显示错误。

如何使用 simpleform 为 select 指定标签?

【问题讨论】:

  • 接受一些问题...

标签: ruby-on-rails-3 simple-form


【解决方案1】:

这是因为 f.select 不是 simple_form 方法,不支持 :label

这应该适合你/简单的形式

&lt;%= f.input :source_type, :label =&gt; "Lead or VTeam", :collection =&gt; ["lead","vteam"], :selected =&gt; "lead" %&gt;

希望对你有帮助

【讨论】:

  • 这是我找到的唯一一个实际的非模型 simple_form 示例。嘘!
  • @BobWalsh 简单表单文档虽然有一些漏洞,但肯定会区分 Rails 的默认 form_builders,例如。选择和简单表单的构建器输入以及混合使用它们的能力。 Custom-Inputs
  • 衷心感谢...我不知道为什么简单的表单文档如此糟糕。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-02-05
  • 2015-06-06
相关资源
最近更新 更多