Shopify themes, liquid, logos, and UX
Hello, I would like to use google recaptcha on my custom form on a custom page.
How to do it?
This is how to do it (assuming you know how to get the key). Add this script to the bottom of the liquid page of where you want to put your code. Change the xxx-site-key code to your own.
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
<div id="re-captcha"></div>
<script>
var actCallback = function (response) {
$('#contactFormSubmit').prop("disabled", false);
$('#re-captcha').remove();
};
var expCallback = function() {
$('#contactFormSubmit').prop("disabled", true);
};
var onloadCallback = function () {
var widget = grecaptcha.render(document.getElementById("re-captcha"), {
'sitekey' : "site-key-codexxx", // Sitekey, Retrieving from reCaptcha
'theme': "light",
'callback' : actCallback,
'expired-callback': expCallback,
});
}
</script>
the code is worked but when submit the form it's show 404 error how to solve the issue
@Feddrow1 Did you get the solution for 404 as I am also facing the same issue after implementing the code.
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024