Multiple submissions of the same form on double-clicking "Select entities"

Created on 8 December 2016, over 8 years ago
Updated 11 August 2024, 8 months ago

Even though this is not inherent to DropzoneJS, but rather to Drupal core Javascript + Chrome, I experienced it heavily when using FileBrowser + DropzoneJS.

The problem

Validation error is triggered when double-clicking on "Select entities", the message displayed is:
"At least one valid file should be uploaded.".
This is the case for the Chrome web-browser, Firefox seems to be fine.

Reproducing

You can easily reproduce this problem without killing your index-finger.

  1. Fire-up your Chrome
  2. Simply add a sleep(2) at the beginning of the DropzoneJsEbWidget::validate() function.
  3. Then click once on "Select entities" after dropping an image into your FileBrowser/Dropzone.
  4. Within the next two seconds click again on "Select entities".
  5. This should give you the validation error message "At least one valid file should be uploaded."

Solution
Use a two-sided extension to the form submission and validation constraints:

  • using the lock service on the server side
  • using javascript (e.g. jquery.form-submit-single) on the client side to ensure forms are submitted once, even while double-clicking in Chrome

References

🐛 Bug report
Status

Needs work

Version

1.0

Component

User interface

Created by

🇨🇭Switzerland stefanos.petrakis@gmail.com Biel, Switzerland

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024