如何更改Rails 4中的按钮文本?

时间:2022-09-25 15:14:12

How Do you change the text of the submit button in Ruby on Rails ? I have tried adding the label method but it won't work.

如何更改Ruby on Rails中提交按钮的文本?我尝试添加标签方法,但它不起作用。

/_form.html.erb

  <div class="form-group">
    <%= f.submit class: "btn btn-primary" , label: "Click Here"%>
  </div>

2 个解决方案

#1


6  

instead of using label use

而不是使用标签

<div class="form-group">
  <%= f.submit "Click Here", class: "btn btn-primary" %>
</div>

#2


3  

You can give custom button name like:-

您可以给出自定义按钮名称: -

<%= f.submit 'custom_btn_name', class: "btn btn-primary" %>

#1


6  

instead of using label use

而不是使用标签

<div class="form-group">
  <%= f.submit "Click Here", class: "btn btn-primary" %>
</div>

#2


3  

You can give custom button name like:-

您可以给出自定义按钮名称: -

<%= f.submit 'custom_btn_name', class: "btn btn-primary" %>