Problem/Motivation

On a page with multiple AJAX forms, a form without the reCaptcha webform (with multiple steps and submit buttons) submit handler cannot be submitted if there is another form on the same page with a reCaptcha webform handler.

Steps to reproduce

  1. Create webform 1, enable ajax and add a Simple reCaptcha webform handler.
  2. Create webform 2, enable ajax and without a Simple reCaptcha webform handler and add multiple steps.
  3. Try going to step 2 of webform 2 using the submit button of webform 2.

Proposed resolution

Check if the current formId is actually the one with the webform recaptcha handler.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

esdrasterrero created an issue. See original summary.

esdrasterrero’s picture

Created a patch that checks if the current form being submitted is actually the targeted form with the recaptcha webform handler.

esdrasterrero’s picture

Issue summary: View changes
louisnagtegaal’s picture

The patch in #2 works for me, but only if I'm using v3. I've added a new patch which also patches the javascript for v2 in the same way.

sokru’s picture

Status: Active » Reviewed & tested by the community

Looks good to me, there might be more elegant way to handle ajax submission check, but I'd consider patch #4 as important addition. Patch contains fixes for line indention. The only actual change is:

+              let currentFormIsRecaptcha = form_values.find(form_id => form_id.value === formId);
+              if (currentFormIsRecaptcha !== undefined) {

sandboxpl’s picture

Status: Reviewed & tested by the community » Fixed

Good catch! I've pushed the code to dev, new release will follow soon.
Thanks for code and test every1!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.