Reputation: 16383
In a ruby on rails form_for
, I want to use a button to submit the form rather than a f.submit
. If the form is for an existing @profile
object, then the following code
<%= form_for @profile do %>
<% f.button submit: 'Change Me' %>
is rendered as button with the text 'Update Profile' instead of 'Change Me'. How do I change the button text?
Upvotes: 0
Views: 1714
Reputation: 16383
The following worked
<%= form_for @profile do %>
<%= button_tag 'Change Me' %>
the reason being that the form_for
helper automatically treats a button within the scope as a submit.
Upvotes: 0