In my Rails 5 application a form's default submit button is disabled on submit to prevent an accidental double submit. Whenever the page is redirected after the submit or re-rendered with validation errors, the button is enabled again.
In my situation I have the controller send a zip file that I build in memory in the controller action using the following:
send_data zip.read, filename: "some_file.zip"
However, after serving the file the form is not re-enabled. I have to ctrl-F5 the page to reset the form and be able to make a different selection.
What is the rails way to do this?
I ran into a similar problem and resolved by using button_tag
instead of submit_tag
. This doesn't re-enable the form, but stops it from being disabled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With