Rails: How to change the text on the submit button in a Rails Form
i have listed my _form.html.erb file below what i would like to do is change the text on the submit button i know how to do it in html but not shure how to do it in Rails 3
%= form_for(@faq) do |f| %>
<% if @faq.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@faq.errors.count, "error") %> prohibited this faq from being saved:</h2>
<ul>
<% @faq.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :question %><br />
<%= f.text_field :question %>
</div>
<div class="field">
<%= f.label :answer %><br />
<%= f.text_area :answer %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
instead of
<%= f.submit %>
put
<%= f.submit "My Submit Text" %>
If you want to change all create and update form submit tags, this change is easy to make. Modify config/locales/en.yml
like so:
en:
helpers:
submit:
create: "Crear un %{model}"
update: "Confirmar cambios al %{model} creado"