I have a form and am using Formtastic. I want to have two options for the button and to store the value selected in the newly created record.
Would I do something like this?
<%= form.buttons do %>
<%= form.commit_button :value => "Give" %>
<%= form.commit_button :value => "Request" %>
<% end %>
commit_button()
takes a first argument as a String, or, to match the input()
API, it also accepts a :label
option. These two are functionally equivalent:
<%= f.commit_button :label => "Save" %>
<%= f.commit_button :label => "Save and Continue Editing" %>
<%= f.commit_button "Save" %>
<%= f.commit_button "Save and Continue Editing" %>
There's no APIs yet for cancel buttons, reset buttons, etc. You can also use standard Rails helpers like link_to and puts some mark-up around them:
<%= f.buttons do %>
<%= f.commit_button :label => "Save" %>
<li class="cancel">
<%= link_to "Cancel", foos_path %>
</li>
<% end %>