Prevention of multiple submits blocks use of back navigation

Created on 1 June 2020, over 4 years ago
Updated 26 September 2024, 3 months ago

The issue is with the double click prevention in form.js `Drupal.behaviors.formSingleSubmit`. It serializes the form data and prevents consecutive submissions of the same data, as in a double click.

But it also prevents submission of non-consecutive form submissions with the same data. Steps to replicate:

  • Visit /admin/structure/types/manage/page
  • Click 'Save content type'
  • Click the browser back button
  • Try to click the 'Save content type' button without changing any of the form data

This seems to be quite heavy handed, the only way out of this form is to use navigation on the page, or the forward button, none of which are obvious or intuitive.

This issue also occurs when there are more steps between first clicking 'Save content type' and going back, for example:

  • Visit /admin/structure/types/manage/page
  • Click 'Save content type'
  • Click 'Edit' for the article content type
  • Click 'Save content type'
  • Click the browser back button
  • Click the browser back button
  • Click the browser back button
  • Try to click the 'Save content type' button without changing any of the form data

This now starts to be quite a negative effect for journeys with multiple steps in them, and starts to break the back navigation within these journeys. IMO this js should only prevent consecutive form submissions. Am I missing something? Or is there a way to do this, it's not obvious to me.

Thanks.

🐛 Bug report
Status

Active

Version

10.2

Component

forms system

Created by

🇬🇧United Kingdom kalpaitch

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.

  • 🇧🇪Belgium weseze

    I'm reopening this because it still exists. At least in my test in Drupal 10.2 but I'm assuming it also exists in 10.3 and 11.
    You do have to use certain browsers.

    In Chrome this is not an issue for me: version 127.0.6533.89 (Official Build) (arm64)
    In Firefox this is an issue: version 130.0.1 (64-bit)
    Client working in latest version of Edge also reported this problem.
    A colleague working in Firefox Developer Edition (latest up-to-date version) also reported this problem.

    This was tested using the test scenario as described by kalpaitch in the original post.

    We first encountered this issue in a commerce setup, where this is issue was already reported several times, but no solution yet.
    🐛 Using the browser's back button disables checkout button on cart form Active
    🐛 Next buttons are blocked until page refresh after use browser's back button Active

    There are 2 ways to get it working again (not a fix, but might give some insight into what the problem is):
    1/
    Inspect the page, navigate to the form element and remove the "data-drupal-form-submit-last" attribute.
    2/
    Make any change in any of the fields in the form.
    Both of these make the form work again.

    I have traced back the "data-drupal-form-submit-last" and it has something to do with preventing the form from being submit (double clicking the submit)

  • 🇳🇿New Zealand quietone

    Drupal 10.2 is now only receiving security support.

    @weseze, Can you confirm that this problem exists on Drupal 11. And are the steps to reproduce in the issue summary correct?

  • 🇳🇿New Zealand quietone

    I am going to move this to 11.x for now because changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies and will be visible to more people.

Production build 0.71.5 2024