Hi @coelmay ,
Thank you very much for such a fast and detailed answer.
I think there was a misunderstood : I am using reCaptcha v2 Netlify built-in feature, as described here : Spam filters | Netlify Docs
I am using the basic one, just by adding data-attribute to my form : data-netlify-recaptcha="true"
So, I do not have any reCaptcha lib JS code directly included into my project, and I do not have any API key. That makes the github example you provided not usable in my case.
Still tried the code from your second answer, and it doesn’t seem to be working ! The button remains disabled. I actually got this error :
site-3678d344c97845021729.js:517 Uncaught TypeError: grecaptcha.getResponse is not a function
at unHideButton (site-3678d344c97845021729.js:517)
at HTMLDocument.<anonymous> (site-3678d344c97845021729.js:195)
Also note that using reCaptcha feature from Netlify does not prevent the form to be sent when the captcha is not checked, the form is still being sent, and current page reloads, losing all the data typed in the form.
So if it is not possible to play with my submit button, I think another alternative would be to use a cookie to store the data typed into the form, in case of the user doesn’t check the captcha, I can redirect him to the same page, with the form pre-filled with previous data, and maybe a notice telling him to make sure he checks the box.
What do you think ?