brojsimpson
brojsimpson

Reputation: 135

Why is disable_with not working for a rails form_for?

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?

Upvotes: 4

Views: 6034

Answers (2)

Charlie
Charlie

Reputation: 341

<%= button_tag 'submit', data: { disable_with: "Processing..." }, class: 'btn btn-info btn-block' %>

Upvotes: 3

konyak
konyak

Reputation: 11716

Check the following in your raw html:

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

Upvotes: 6

Related Questions