Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
164
rated 0 times [  168] [ 4]  / answers: 1 / hits: 106189  / 9 Years ago, mon, february 23, 2015, 12:00:00

I have added the following before end of head



<script src='https://www.google.com/recaptcha/api.js'></script>


I have added this before end of form



<div class=g-recaptcha data-sitekey=== xxxxxx ==></div>


I can see the recaptcha similar to https://developers.google.com/recaptcha/



HOwever, when user presses data without checking the checkbox, the data is submitted. Is there any other code I need to add to check if user has pressed the checkbox? Hopefully in js?


More From » jquery

 Answers
3

Google has a call back option for when the checkbox is checked.



Add this to your form element:



data-callback=XXX


Example:



<div class=g-recaptcha data-callback=recaptchaCallback data-sitekey=== xxxxxx ==></div>


And a disable attribute to your submit button.



Example:



<button id=submitBtn disabled>Submit</button>


Then a create a callback function and write whatever code you need.



Example:



function recaptchaCallback() {
$('#submitBtn').removeAttr('disabled');
};

[#67707] Friday, February 20, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
katieh

Total Points: 692
Total Questions: 104
Total Answers: 104

Location: Armenia
Member since Sat, Dec 31, 2022
1 Year ago
;