After enabling captcha for the contact form the captcha is not shown on the form. If submitted an "Incorrect CAPTCHA" error is displayed. Tried in production and development modes. No Javascript errors in the console.


@dhob68 Unfortuanally, I can't reproduce this problem. May you please let me know if this issue relevant for latest release version of Magento 2?
Same thing happens with 2.1.7. I do override vendor/magento/module-contact/view/frontend/templates/form.phtml with app/design/frontend/my/theme/Magento_Contact/templates/form.phtml. This is the same file with our address and a google map added at the bottom of the page. I'm not sure how the CAPTCHA works but I do not see any mention of CAPTCHA in vendor/magento/module-contact/view/frontend/templates/form.phtml
Yes me to facing same problem captcha is enabled in backend but not showing in front end .I cleared cache too but it's not working
me too facing this issue in forgot password page. I know this issue face because session gets captcha diffrent.

@dhob68 can you reproduce this issue with original form.phtml?
@Gammatesting123 you describe slightly different issue, please describe it in separate GitHub issue according to the Issue reporting guidelines: with steps to reproduce, actual result and expected result.
Please, also identify which version of Magento you are running.
My problem has been fixed. The default title for the contact us page is "Create New Customer Account" so I overrode contact_index_index.xml to change the page title to "Contact Us" when I did that, I just copied the original file and added code to change the title. I had to remove the following XLM from contact_index_index.xml to get it to work.
<referenceContainer name="content">
<block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
<container name="form.additional.info" label="Form Additional Info"/>
</block>
</referenceContainer>
Based on reporter comment the problem is not actual any more
Just for posterity, I also ran into this issue and fixed it by giving read/write access (fixing permissions) to var/* and pub/*.
Hi @dhob68 ,
Your solution has worked for me. Thanks a lot.
Hi @dhob68. Thanks a lot for your answer.
Title of the page is not set to "Contact Us".
Thanks @dhob68
app/design/frontend/Pearl/weltpixel/Magento_Contact/layout/contact_index_index.xml
Remove the head/title tags from the contact_index_index layout xml.
<head>
<title></title>
</head>
Note: This is on an older WeltPixel theme version: 101.8.2 with Magento 2.3.0
I checked another newer site and in recent WeltPixel Pearl themes they removed the head block from the layout xml actually.
Did the rebuild static content deploy etc page title now says "Contact Us" but no luck :(
vendor/magento/module-contact/view/frontend/layout looks like this.
<?xml version="1.0"?>
<!--
/**
* Copyright 漏 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>Contact Us</title>
</head>
<body>
<referenceContainer name="content">
<block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
<container name="form.additional.info" label="Form Additional Info"/>
</block>
</referenceContainer>
</body>
</page>
So that is where the Contact Us title comes from.
I find it strange that Captcha would be based off a title?..
Captcha in Magento 2 is handled by the built-in msp/recaptcha extension in Magento >2.3.0.
https://docs.magento.com/m2/ce/user_guide/stores/security-google-recaptcha.html
This is configured and working for other pages such as registering an account.
cd vendor
ag "Incorrect reCAPTCHA"
Shows me it is specified in this file.
msp/recaptcha/Model/Config.php
73: return __('Incorrect reCAPTCHA');
```
ag isEnabledFrontendContact
msp/recaptcha/Model/LayoutSettings.php
57: 'contact' => $this->config->isEnabledFrontendContact(),
Used in getCaptchaSettings() see ['enabled']['contact']
ag getCaptchaSettings
msp/recaptcha/Block/LayoutProcessor/Checkout/Onepage.php
65: ['msp_recaptcha']['settings'] = $this->layoutSettings->getCaptchaSettings();
68: ['msp_recaptcha']['settings'] = $this->layoutSettings->getCaptchaSettings();
msp/recaptcha/Block/Frontend/ReCaptcha.php
98: $this->layoutSettings->getCaptchaSettings(),
msp/recaptcha/Model/LayoutSettings.php
45: public function getCaptchaSettings()
msp/recaptcha/Plugin/Block/Account/AuthenticationPopupPlugin.php
64: = $this->layoutSettings->getCaptchaSettings();
Block/Frontend/ReCaptcha needs to be added to contact_index_index
I had previously hidden the reCAPTCHA badge with css.
```css
/* Hide reCAPTCHA badge. */
.grecaptcha-badge { visibility: hidden; }
https://webdeasy.de/en/hide-google-recaptcha-badge/
When removing that, I saw this text in their badge.
"This site key is not enabled for the invisible captcha."
This website I'm working on also had Mageplaza_GoogleRecaptcha at one point although it is disabled.
JS Console error.
jquery.js:243 Uncaught TypeError: Cannot read property 'nodeName' of undefined
at acceptData (jquery.js:243)
at internalData (jquery.js:249)
at Function._data (jquery.js:266)
at UiClass.initCaptcha (reCaptcha.js:6)
at reCaptcha.js:7
at dispatch (jquery.js:351)
at elemData.handle (jquery.js:324)
at Object.trigger (jquery.js:345)
at Object.jQuery.event.trigger (jquery-migrate.js:54)
at jquery.js:395
Changed it to use v2 invisible key, now that errors gone. (But error was not there yesterday) and it still works fine on other pages such as login. Cache cleared, cloudflare cleared.
Im at a loss :(
No success getting it to work here for now, configuration of key/settings worked fine to protect other pages.
Just leaving this here in-case it helps someone or my-self in the future.
Most helpful comment
My problem has been fixed. The default title for the contact us page is "Create New Customer Account" so I overrode contact_index_index.xml to change the page title to "Contact Us" when I did that, I just copied the original file and added code to change the title. I had to remove the following XLM from contact_index_index.xml to get it to work.