When creating a new activity, it double-creates the activity (5.12+)
Steps to reproduce:
- In "Admin => Display Pref", enable AJAX forms. (This is the default.)
- Navigate to "View Contact" for some contact record
- Choose "Actions => Meeting"
- In the dialog, enter a "Subject" and use the mouse-pointer to click the "Save" button
- Observe: The dialog will close, and two activities will be created.
- Observed on 5.12, 5.13, and master using
drupal-cleanbuild type. But 5.11 seemed OK.
- At first, it seemed a bit random - so one may need to retry a couple times to reproduce it. However, I think I've narrowed it down:
- The problem does manifest if you submit the AJAX form by using the mouse-pointer to click the "Save" button
- The problem does not manifest if you submit the AJAX form by using the keyboard to press "Enter".
- The problem does not manifest with traditional/non-AJAX/full-page forms.
- On 5.12, reverting https://github.com/civicrm/civicrm-core/pull/13342/ fixes the issue. (I've not yet tried reverting on 5.13 or master.)
- (Note: Should re-check this. At the time when this was tested, I hadn't figured out that it was appropriate to control for keyboard "Enter" versus mouse "Save".)
- On 5.13, applying https://github.com/civicrm/civicrm-core/pull/14196/commits/0b35176b3eaef3710d40b3c6ab7a0ff83eaf722b or https://github.com/civicrm/civicrm-core/commit/bd756b532fae718ed3516ec49d7baf914acc0a56 does not produce better errors or fix the issue. (So I think they're dealing with a different aspect of submitOnce)
Related history: There have been several patches/issues in this space in recent months. Here's a snapshot at the time of writing:
- Make submitOnce() button js into a button parameter (no gitlab)
- (dev/core#903) When adding activity, a double click submits twice (Apr 26-29) (Closed dupe as resolved ^^^)
(dev/core#904) PR 13333 breaks the Save and New button on a new case
- (PR 14145) undo part of 13333 (Apr 26-29) (First published: 5.13.0)
(dev/core#914) submitOnce revisited (Apr 29-now)
- (PR 14196) avoid multiple submitOnce buttons until better way (May 1-now) (Not yet merged)