- Issue created by @amityweb
- 🇬🇧United Kingdom amityweb
I notice if I am logged in as admin it does not work.
So I logged out, and now I can see the relevant JS code and other HTML on the page for it, BUT, the V2 checkbox still does not appear. When I submit the form I get the error:
There was an error during validation of your form submission, please try to reload the page and submit form again.If I switch to V3 I can see the badge, but the form submits OK. How can I know its implementing ReCaptcha when V2 is not working? I cant trust it.
Thanks
- 🇬🇧United Kingdom amityweb
I found one issue, but this does not solve it...
The webform ID is contact_us
But when I dump the form_id passed to your code it's:
webform_submission_contact_us_block_content_4_add_formSo that's incorrect, you should be using the actual ID showing in the URL and the form ID called. Its in the $form array passed as "webform_id" but looks like you are using form_id.
- 🇵🇱Poland sandboxpl Poland 🇵🇱
Hi, thanks for the feedback, please check following thigs:
I notice if I am logged in as admin it does not work.
There is a bypass of validation for admins indeed, the module provides permission for that:
https://git.drupalcode.org/project/simple_recaptcha/-/blob/8.x-1.x/simpl...So I logged out, and now I can see the relevant JS code and other HTML on the page for it, BUT, the V2 checkbox still does not appear. When I submit the form I get the error:
There was an error during validation of your form submission, please try to reload the page and submit form again.For v2, the checkbox is hidden by default, and only when you click on submit button it should be rendered, this logic is explained here:
https://git.drupalcode.org/project/simple_recaptcha/-/tree/8.x-1.x?ref_t...
if you get an form validation error, please check dblog, you should see more details about the error in there + corresponding recaptcha error code.If I switch to V3 I can see the badge, but the form submits OK. How can I know its implementing ReCaptcha when V2 is not working? I cant trust it.
V3 is quite invisible, to see it in action you'd have to inspect the document, and look at the hidden element with name=
simple_recaptcha_token
, this one should get filled in with verification token once you submit the form, and it will be sent to recaptcha API for validation. For more detailed investigation you can place breakpoints in here:
https://git.drupalcode.org/project/simple_recaptcha/-/blob/8.x-1.x/src/S...The webform ID is contact_us
But when I dump the form_id passed to your code it's:
webform_submission_contact_us_block_content_4_add_formSo that's incorrect, you should be using the actual ID showing in the URL and the form ID called. Its in the $form array passed as "webform_id" but looks like you are using form_id.
Adding the webform_submission_contact_us_block_content_4_add_form to the list of forms to add ReCaptcha to still does not show it though.
Using form IDs for webforms is not reliable at all, please try to install simple_recaptcha_webform submodule, and add handler directly to the webform.