Why is disable_with not working for a rails form_for?

forms, jquery, jquery-ui, ruby-on-rails, ruby-on-rails-3.2

Solution

Check the following in your raw html:

- the submit button has data-disable-with attribute

- your page includes jQuery js. For me I have:

- https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js

- you page includes jquery_ujs js. For me I have:

- /javascripts/jquery_ujs.js

You can read more on https://github.com/rails/jquery-ujs.

Problem

My form looks like this: ``` <%= form_for(@foobar) do |f| %> <%= render 'shared/error_messages', object: f.object %> ~~~form stuff~~~ <%= submit_tag "submit", data => { disable_with: "Processing" }, :class => "btn btn-info btn-block" %> <% end %> ``` I'm running rails 3.2.11. I have the jquery-rails gem installed and all my other jQuery stuff works. Why am I still able to hit the "submit" button multiple times while it's still loading? How do I disable the button?

Original source