2

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.

Nick
  • 9,493
  • 8
  • 43
  • 66

1 Answers1

1

May be change 'cancel' button to link with the same css.

gayavat
  • 18,910
  • 11
  • 45
  • 55
  • Here's the code I used: `<%= link_to "Cancel", @user, :class => 'btn' %>`. Note: I'm using Twitter Bootstrap for my CSS framework. – Nick Mar 22 '12 at 16:28