Reputation: 21
I'm using button_to in a page for downloading a PDF file.
= button_to "Download Report", evaluation_report_attempt_path, method: :get, class: "btn btn-primary", data: { disable_with: "Downloading..."}
There is no page redirection happening here. After the file is downloaded, the button remains disabled. How do I re-enable the button after the function is completed?
Upvotes: 2
Views: 401
Reputation: 375
Yo can try these
$(window).unload(function() {
$.rails.enableFormElements($($.rails.formSubmitSelector));
});
Upvotes: 0