Problem/Motivation

Webform adds a $form['#method'] ('get') in lowercase, and this then is not matched by Drupal.behaviors.formSingleSubmit 'form:not([method~="GET"])' javascript. Thus cannot be submitted twice.
The lowercase method name could also be set via form alterations etc.

Proposed resolution

The single submit form selector should be case insensitive.

Remaining tasks

Needs JS tests.

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork drupal-3024953

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ytsurk created an issue. See original summary.

ytsurk’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new747 bytes
jrockowitz’s picture

Right now, Drupal's Form API outputs a lowercased form method attribute for 'post'.

I would argue that the form method attribute is generally lowercase and Drupal.behaviors.formSingleSubmit should be updated to support 'GET' or 'get'. Uppercasing the form method attribute could cause some (unlikely) regressions if someone was looking for a lowercased 'get' or 'post'.

Status: Needs review » Needs work

The last submitted patch, 2: 3024953-form_method_normalization-2.patch, failed testing. View results

berdir’s picture

Version: 8.6.x-dev » 8.7.x-dev
ytsurk’s picture

Title: Normalize form method (uppercase) » Drupal.behaviors.formSingleSubmit should be case-insensitive
Issue summary: View changes
Issue tags: -Needs tests
ytsurk’s picture

Title: Drupal.behaviors.formSingleSubmit should be case-insensitive » Drupal.behaviors.formSingleSubmit method name should be case-insensitive
ytsurk’s picture

Status: Needs work » Needs review
Issue tags: +JavaScript
StatusFileSize
new1.58 KB

A new patch for the case insensitive approach. I did not use a i-RegEx form:not([method~="GET" i]) by intent, as it seems not to be supported by IE11, see https://stackoverflow.com/questions/19465157/case-insensitive-jquery-att....

ytsurk’s picture

StatusFileSize
new1.68 KB

Made sure to keep storing the form values.

ytsurk’s picture

Issue summary: View changes
Issue tags: +Needs tests
ytsurk’s picture

Issue summary: View changes

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

berdir’s picture

Rerolled.

ranjith_kumar_k_u’s picture

StatusFileSize
new1.54 KB
new962 bytes

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Bug Smash Initiative

Moving back to needs work for the tests.

Also most likely will need a reroll for 10.1 but triggered #19 for 10.1.x tests.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new1.63 KB
new825 bytes

Rerolled for 9.5 and 10.1. No idea where to start with tests for this or if we have any existing tests for the functionality in HEAD.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

I would look in FormBuilderTest maybe?

Line 897 does something with #method
Maybe could expand dataProvider to provide one that fails? Not sure how webform is triggering the issue.

ytsurk’s picture

The issue in webform is resolved #3024957: Drupal.behaviors.formSingleSubmit method name should be case-insensitive - multiple GET submissions not possilbe.

The test could live around FormValuesTest,
we would need a from like $this->drupalGet('ajax_forms_test_get_form') altered to have it's method lowercase.
Then doing two submits .. and the second should work too.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.