I use https://github.com/karliuka/m2.ReCaptcha module for google recaptcha its work fine. But if when we submit the form without checked the captcha then its refresh the Page and then show error. how can show error before refresh the page like https://crosstec.org/breezingformsdemo/index.php/breezingforms-demos/bootstrap-based-forms/recaptcha.html
1 Answer
First, generate reCAPTCHA keys - Site Key and Secret Key by going to Google reCAPTCHA
Then run these commands:
composer require msp/recaptcha:2.0.0
php bin/magento module:enable --all
php bin/magento setup:upgrade
php bin/magento cache:clean
Now go to STORES → Configuration from the admin panel of your store and then click on Google reCaptcha under Security tab where you have to enter Site and Secret key which you have generated.
Now to add on the contact form, unfold the frontend section, enable ReCaptcha and select Yes for Use in Contact.