I want to generate a cancel button using simple_form....but not quite sure how to do that.
<%= f.button :submit, :class => "btn btn-warning btn-small", :label => "Save Changes" %>
<%= f.button :cancel, :class => "btn btn-inverse btn-small", :label => "Cancel" %>
But the cancel button doesn't work.
How do I get that?
Should this be supported by simple form? I had a quick look at github and did not find anything related.
How about link_to "Cancel", :back
?
You can do it with bootstrap easily.
<button type="submit" class="btn btn-default">Create Plan</button>
<%= link_to "Cancel", :back, {:class=>"btn btn-default"} %>
Using simple_form and erb:
<%= f.submit, 'Save', class: 'btn btn-primary' %>
<%= f.button :button, 'Cancel', type: :reset, class: 'btn btn-none' %>
Doing this does not take you to the previous page, it resets the form to its initial state.
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