Reputation: 9876
I have two buttons for my form - a Save changes button and a Cancel button. The Save changes button has the a disable_with: 'Saving...'
attribute. Because both buttons are submit buttons, the :disable_with
activates even when the Cancel button is clicked. (The Cancel button code was derived from this link: http://www.keenertech.com/articles/2007/04/10/multiple_form_buttons_in_rails)
<%= form_for(@user) do |f| %>
# form fields
<%= f.submit "Save changes", :class => 'btn btn-primary', name: 'confirm', disable_with: 'Saving...' %>
<%= f.submit "Cancel", :class => 'btn', name: 'cancel' %>
<% end %>
Any ideas on how I can get a Cancel button that doesn't trigger the :disable_with
of my Save changes button? I obviously don't want the user to think that the form is saving when they click Cancel.
Upvotes: 2
Views: 2012