Captcha placement below Webform actions when Submit button(s) customized

Created on 4 March 2024, 10 months ago
Updated 5 March 2024, 10 months ago

Problem/Motivation

There is an issue with the CAPTCHA module's placement on webforms when customizing the Submit button(s). Specifically, with Drupal/webform version 6.2.2, customizing the Submit button(s) modifies the form array by adding 'actions' to the form 'elements' keys. This modification is not recognized by _captcha_get_captcha_placement(), resulting in the CAPTCHA appearing below the Submit button(s) instead of above them, as intended.

Steps to reproduce

  1. Configuration - CAPTCHA settings - Add CAPTCHA cahllenged on all forms
  2. Create a Webform and add at least one Element to it.
  3. Find the "Submit Button(s)" section and click "Customize."
  4. Enter a label for the Submit button and click "Save."
  5. Captcha now dispalys below the Submit button

Proposed resolution

Update captcha.inc _captcha_get_captcha_placement to handle

$form['elements']['actions']
// not just
$form['actions']

Remaining tasks

I plan to create a merge request with proposed solution.

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States ian.ssu

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024