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<
When writing in erb
<%= f.submit "your text" %>
when writing in HAML
= f.button :submit, "your text"
In HAML comma should be there after submit otherwise it will throw error.
Sometimes using helpers is not acceptable because of used text or you need additionally add class etc., so you can directly override value
:
<%= f.submit class: 'btn btn-primary', value: 'Login' %>
or:
<%= f.button :submit, class: 'btn btn-primary', value: 'Login' %>
By the way it was mentioned by @cassi.lup in comment to accepted answer.
Tested on Rails 4.2.3.
for Slim version use value="xyz" to change the default submit input text.
Its simple, use
<%= f.submit 'Desired text on the button' %>
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"
Building on @daniel's answer, you can also customize submit tag values on a per-model basis:
en:
helpers:
submit:
model_name:
create: "Create"
update: "Update"
And then in your form you can just use:
<%= f.submit %>
See here for the documentation (second example.)