Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make reCAPTCHA a required field?

Tags:

recaptcha

I'm using Google reCAPTCHA and have been able to add the CAPTCHA component to my page inside a form. But when I submit the form there's no validation taking place to check if the CAPTCHA has been solved.

How do I validate that the CAPTCHA component has been solved when submitting my form? Or, in other words, how do I make my CAPTCHA component required?

like image 597
Baikare Sandip Avatar asked Dec 30 '14 13:12

Baikare Sandip


People also ask

What is reCAPTCHA required?

About reCAPTCHA reCAPTCHA is a free service from Google that helps protect websites from spam and abuse. A “CAPTCHA” is a turing test to tell human and bots apart. It is easy for humans to solve, but hard for “bots” and other malicious software to figure out.

What does the G reCAPTCHA response field is required mean?

That means your captcha request didn't send to google properly. Did you see the badge logo on the right-bottom side? If not, you might render your captcha in a wrong way. You can post the code how you render your captcha in your view that I can have more info about your issue. All reactions.

How do I fix CAPTCHA validation error value required?

Answer: This can be caused when the reCaptcha public key is correct but the private key is incorrect. Verify that the private key is correct in Administration > Sites & settings and attempt to donate again.


1 Answers

if you want to use the native html5 popups, than here is the solution

JavaScript:

window.onload = function() {     var $recaptcha = document.querySelector('#g-recaptcha-response');      if($recaptcha) {         $recaptcha.setAttribute("required", "required");     } }; 

CSS:

#g-recaptcha-response {     display: block !important;     position: absolute;     margin: -78px 0 0 0 !important;     width: 302px !important;     height: 76px !important;     z-index: -999999;     opacity: 0; } 
like image 144
Fred Avatar answered Sep 17 '22 15:09

Fred