Download the PHP package cyber-duck/silverstripe-recaptcha without Composer
On this page you can find all versions of the php package cyber-duck/silverstripe-recaptcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cyber-duck/silverstripe-recaptcha
More information about cyber-duck/silverstripe-recaptcha
Files in cyber-duck/silverstripe-recaptcha
Package silverstripe-recaptcha
Short Description Standard reCAPTCHA and invisible reCAPTCHA form fields for SilverStripe
License MIT
Homepage https://github.com/cyber-duck/silverstripe-recaptcha
Informations about the package silverstripe-recaptcha
Silverstripe-Recaptcha
Standard reCAPTCHA and invisible reCAPTCHA form fields for SilverStripe
Author: Andrew Mc Cormack
For SilverStripe 4.*
Installation
Add the following to your composer.json file and run /dev/build?flush=all
Standard Recaptcha
Add 2 .env vars with your recaptcha keys
Add the field to any form on your site just as you would any other field. Pass in:
- the field name. Also add the field to the required fields list.
Invisible Recaptcha
Add 2 .env vars with your recaptcha keys
Add the field to any form on your site just as you would any other field. Pass in:
- the field name,
- the form ID (without #)
- the HTML element ID (without #) or selector (such as button) to render the reCAPTCHA widget. Also add the field to the required fields list.
Working with jQuery and AJAX
If you would like to use the reCAPTCHA with AJAX you can copy the InvisibleRecaptcha.ss from the module templates folder into your theme templates folder
And just update the onRecaptchaFormSubmit function to use jQuery to select and submit the form
In your AJAX success function, if your form fails validation you can call onloadCallback() to re-render the reCAPTCHA