How to create a cancel button in simple_form?

I want to create a cancel button using simple_form .... but not quite sure how to do this.

<%= 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 does not work.

How do i get this?

+5
source share
5 answers

If it is supported by a simple form? I quickly looked at github and did not find anything related.

How about link_to "Cancel", :back?

+12
source

You can do this with bootstrapping.

<button type="submit" class="btn btn-default">Create Plan</button>
<%= link_to "Cancel", :back, {:class=>"btn btn-default"} %>
+4
source

simple_form erb:

<%= f.submit, 'Save', class: 'btn btn-primary' %>
<%= f.button :button, 'Cancel', type: :reset, class: 'btn btn-none' %>

, , .

+2

, Rails 3:

link_to "Cancel", @foo

@foo - . , , edit new.

0

<%= button_tag "Cancel", :type => 'reset' %>

0

All Articles