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 %>
Input value attribute The value attribute can be used to change the text of the form submit button. Use value attribute within <input> of type="submit" to rename the button.
Yes, structurally the submit button needs to be inside a form element for the document to be valid X/HTML.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With