When creating a new activity, it double-creates the activity (5.12+)
Steps to reproduce:
- Variations: (a.1) Open site in Chrome; (a.2) Open site in Firefox
- 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"
- Variations: (b.1) Use the mouse-pointer to click the "Save" button; (b.2) Press "Enter" to submit.
- Observe: The dialog will close. One activity should be created. However, depending on the variation of procedure and the revision of code, there may be two activities created.
Additional notes:
- Observed on 5.12, 5.13, and master using
drupal-clean
build 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)
- (PR 13333) Make submitOnce() button js into a button parameter (Dec 20 - Feb 7) (First Published: 5.12.0)
- (PR 13342) Remove activitystatus js. Add submitOnce handler for activity create (Dec 21 - Feb 11) (First Published: 5.12.0)
- (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)