【问题标题】:Rails unable to change label in formtasticRails 无法更改格式中的标签
【发布时间】:2020-11-23 13:06:33
【问题描述】:

您好,我是 rails 和 formtastic 的新手。

我已经为使用回形针上传多个文件构建了一个可行的解决方案。

在我的表单中,当我尝试更改上传文件的标签时,即使更改为:

 <%= f.inputs :image, :label => false, :for => :attachments,  :as => :file %>

<%= f.inputs :image, :label => "This label will not display", :for => :attachments,  :as => :file %>

真的很愚蠢的问题,但任何帮助将不胜感激

谢谢

【问题讨论】:

    标签: ruby-on-rails forms formtastic


    【解决方案1】:

    f.inputs 不支持标签属性,如果你想隐藏标签,你应该使用 f.input。或者您可以绕过它并通过 css 隐藏标签。像这样。

    label[for=here_go_your_for_value] {
      display: none;
     }
    

    【讨论】:

    • 谢谢。令人尴尬,但如果它可以帮助 1 个其他人,那么它值得继续生活。
    • * 让我尴尬
    • 这里没什么好尴尬的,继续问学习吧:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-17
    • 2021-04-10
    • 2021-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多