简单形式:是否可以使用标签 i18n 删除标签并用占位符替换它们? [英] Simple Form: Is it possible to remove labels and replace them with placeholders using the labels i18n?
本文介绍了简单形式:是否可以使用标签 i18n 删除标签并用占位符替换它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试生成一个常规的简单表单
I'm trying to produce a regular simpleform form
= simple_form_for [:hq, @team, @order] do |f|
.tickets
= f.select :tickets, :aaa => "aaa"
= render "ticket"
.details
.left
= f.input :address1
= f.input :address2
= f.input :state
= f.input :country
= f.input :email
.right
= f.input :comments
但我希望输入不带有标签,只是占位符中的标题地址行 1".
But I want the inputs to not be rendered with a label, just the title "Address Line 1" in the placeholder.
我知道我可以用 f.input :address1, :placeholder =>"随便", :label =>""
但我希望它可以使用包装器进行配置并采用 i18n 值表单标签,而不是占位符.
I know I can do this with f.input :address1, :placeholder => "whatever", :label => ""
but I'd like it to be configurable with a wrapper and take the i18n value form label, not placeholder.
推荐答案
尝试执行以下操作:
Try doing the following:
f.input :address1, placeholder: "Address Line 1", label: false
这篇关于简单形式:是否可以使用标签 i18n 删除标签并用占位符替换它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文