Just a simple challenge that I'm facing. I'm using Bootstrap Validator to validate my forms and I want to integrate it with Google reCaptcha.
My code
<div class="form-group">
<div class="g-recaptcha" data-sitekey="my site key"></div>
<span class="help-block" style="display: none;">Please check that you are not a robot.</span>
</div>
<span class="help-block" style="display: none;">Please enter a the security code.</span>
<script src="https://www.google.com/recaptcha/api.js"></script>
How to I make it required so that a user cannot submit it without completing the captcha. I've found some javascript to do it but I want to integrate it with this library.
Update
I've used something like this and it works. You can provide feedback if you wish.
<div class="form-group container-captcha">
<label style="display:none;" for="">Check "I am human" below <span class="required"></span></label>
<input type="text" name="recaptcha" required value="" id="recaptchaValidator" pattern="1" data-error="Check `I am human` !" style="display:none;">
<div class="g-recaptcha" data-sitekey="my site key" data-callback="captcha_onclick" align="center" ></div>
<p class="help-block with-errors">Prove you are a human!</p>
<script>
function captcha_onclick() {
$('#recaptchaValidator').val(1);
$('#my-form-id').validator('validate')
}
</script>
</div>
<script src="https://www.google.com/recaptcha/api.js"></script>