Netlify form - Recaptcha not working

Hello, thank you for the response. Manage to find a solution in that article you send.

created a file JS

/*VALIDATE RECAPTCHA FIELD SUBMIT FORM */

function validate_form() {

    const recaptcha_box_checked = (grecaptcha.getResponse()) ? true : false;

    if (recaptcha_box_checked) { 
        return true;
    }
    else {
        alert("falta validar o campo 'Não sou um robô'");
        return false;
    }
}

HTML

<form id="contact-form" method="POST" data-netlify="true" onsubmit="return validate_form();">

Hope helps someone that need to validate a form with recaptcha, so this way won’t receive spam.

1 Like