On pages where a button triggers a download, submitOnce prevents the Done or other buttons from working
Some examples:
-
Thank-you letters for contributions.I was thinking of this comment but I think that got skipped being added because of this problem, i.e. the problem prevents adding submitOnce there. - In CDN Tax Receipts after you download.
- Financial batch exports (although here the submitOnce is drupal 9's submitonce, not civi's, but it's the same thing).
- Contact exports (again drupal 9's, not civi's).
What happens after you download is that any other buttons on the page are frozen, and while you can just go to another page, it obviously isn't working as intended, and for some people they really want a Done button.
Here's two ideas:
- Make these Done/Cancel buttons into
<a>
links instead. They aren't the type of button where double-clicking causes a problem, so don't need the submitOnce protection.
In a few cases this might not trigger the complete quickform cycle, but does it matter if the purpose of the button is to just leave the page? - Provide a way in CRM_Core_Form::addButton to opt-out for specific buttons, but since the submitonce protection is a
<form>
property this seems like it would be adding in some awkward code, and it's new code that is hard to write tests for, and would also need something special for drupal 8/9.