πŸ‡ΊπŸ‡ΈUnited States @fholub13

Account created on 10 March 2023, over 1 year ago
#

Recent comments

πŸ‡ΊπŸ‡ΈUnited States fholub13

fholub13 β†’ created an issue.

πŸ‡ΊπŸ‡ΈUnited States fholub13

Ran into a similar issue with AJAX wherein there were two custom forms on a page, provided by separate custom modules. One is in the site header as a custom search block and the second as a form class that serves as the content for a custom route. An AJAX handler defined for the second form submit element was binding to the submit element of the first form. Both elements had the default id of #edit-submit.

This issue only occurs for anonymous users. The AJAX handler actually binds correctly given the following is true:

  1. Cache was cleared.
  2. The first page visited after the cache clear was the custom form route.

After identifying this behavior, the workaround we devised for this particular instance was to modify the submit element of the first form to have custom id and data-drupal-selector attributes while leaving the second form as-is.

Before

    $form['container']['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Search'),
    ];

After

    $form['container']['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Search'),
      '#attributes' => [
        'id' => 'edit-submit-prod-num',
        'data-drupal-selector' => 'edit-submit-prod-num',
      ],
    ];
πŸ‡ΊπŸ‡ΈUnited States fholub13

#10 worked for me as described.

πŸ‡ΊπŸ‡ΈUnited States fholub13

#5 was my exact experience as well. I had the aforementioned former patch installed (3316975-15) on a client site and was experiencing the error detailed in this issue. Removing the patch, deleting the module directory, and running a new composer install remedied the error.

Production build 0.71.5 2024