Reputation: 8461
I'm trying to disable a button on submit with data-disable-with but I can't seem to get it working on my form.
Here is what I'm trying:
<%= submit_tag "Publish", { class: 'button', data: { disable_with: "Please wait.." } } %>
The class is being applied but when I submit the form nothing gets disabled. What am I doing wrong?
Upvotes: 0
Views: 3505
Reputation: 762
You can try using the button_tag
:
<%= button_tag "Publish", class: 'button', data: { disable_with: "Please wait.." } %>
Upvotes: 1
Reputation: 1230
tested your button tag with an example and it is working fine
<%= form_tag '/', method: :get do %>
<%= submit_tag "Publish", { class: 'button', data: { disable_with: "Please wait.."} } %>
<% end %>
make sure you have //= require rails-ujs
in application.js file
also can you show more code?
Upvotes: 0