How to add reCAPTCHA to custom forms
I already enabled the reCAPTCHA plugin and it is working in registration form.
Now I have a custom form for anonymous users and I want to use reCAPTCHA in it. Is there a way to add it in a form?
Thanks
0
I already enabled the reCAPTCHA plugin and it is working in registration form.
Now I have a custom form for anonymous users and I want to use reCAPTCHA in it. Is there a way to add it in a form?
Thanks
Comments
Yes. Its as easy as adding this to your form validation logic
if (Captcha::validate() !== true) { $sender->Form->addError(Gdn::translate('The captcha was not completed correctly. Please try again.')); }...and this to your form view:
Captcha::render($this);I also add this in the form
<?php echo $this->Form->label("Security Check", ''); echo $this->Form->captcha(); ?>Thanks!