Problem/Motivation

The same issue as found in this report: https://www.drupal.org/project/captcha/issues/3426421 exists for version 8.x-1.17. When an image captcha is on a webform with a file upload field, this creates the error:

Missing required form ID on route entity.node.canonical

This does not affect the end user's ability to submit the webform and all data is successfully saved. This just generates the above error for every file upload field.

Steps to reproduce

Place an image captcha on the same webform page as a file upload. Upload a file, fill in the captcha and save. The error will appear in the watchdog logs.

Issue fork captcha-3589845

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

bdunphy created an issue. See original summary.

avpaderno’s picture

Version: 8.x-1.17 » 8.x-1.x-dev

japerry made their first commit to this issue’s fork.

japerry’s picture

Status: Active » Needs review

The cause: a managed_file "Upload" button has #limit_validation_errors.

The MR changes the callback so it only acts when the image was actually built. With no image there is nothing to attach a refresh link to, so it returns quietly. The error is now logged only when an image exists but the form ID is missing. Nothing changes for normal page loads or the real submit.

Also added a new functional test, ImageCaptchaLimitedValidationTest. It submits a limited-validation "Upload" button on an image CAPTCHA form and asserts that nothing is logged.

  • japerry committed ca1d8228 on 2.x
    fix: #3589845 Do not log missing form ID when the image CAPTCHA was not...
japerry’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.