加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 简单表单:是否可以删除标签,并使用标签i18n替

发布时间:2020-12-16 19:41:29 所属栏目:百科 来源:网络整理
导读:参见英文答案 How to use placeholders instead of labels in simple_form?4个 我试图制作一个普通的简单形式 = simple_form_for [:hq,@team,@order] do |f| .tickets = f.select :tickets,:aaa = "aaa" = render "ticket" .details .left = f.input :addres
参见英文答案 > How to use placeholders instead of labels in simple_form?4个
我试图制作一个普通的简单形式
= 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”.

我知道我可以用f.input:address1,placeholder => “whatever”,:label => “”但是我希望可以使用包装器进行配置,并使用i18n值表单标签,而不是占位符.

解决方法

尝试执行以下操作:
f.input :address1,placeholder: "Address Line 1",label: false

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读