I have a Rails Devise form that has javascript validation. When the user presses submit, the validation works and the user is refocused on the form where they need to be.
Look at my answer.
$button = $('#someId')
$.rails.enableElement($button)
$button.removeAttr('disabled')
https://stackoverflow.com/a/44318786/4349494
I managed to solve this quite simply. I just went in and removed the data-disable-with from the button with the code:
$('#my-button').removeAttr('data-disable-with');
And then re-establishing the attribute when the form was ready to be submitted to prevent double clicks from creating duplicates.
This behaviour was changed in Rails 5, now it's disabling submits by default.
Rather than accepted answer, I would suggest to use the following configuration:
config.action_view.automatically_disable_submit_tag = false
or, to do it ad-hoc for specific buttons, add this to the submit button
data: { disable_with: false }
This was helpful to give me a hint on what to look for. If anyone is looking how to correct this in your html.erb file, this was my solution:
<p>
<%= f.submit 'Submit', data: { disable_with: false } %>
</p>