Easily add Google reCAPTCHA to your netFORUM forms
- Navigate to Google reCAPTCHA page
- Sign up for an account
- Follow the instructions. Note: for testing, you can specify "localhost" for your URL. Important: You must specify your production domain urls in the Domains list for your reCAPTCHA site for the reCAPTCHA to work on your non-localhost url.
- Download Latest Release
- Copy contents of release to eWeb folder
- Execute reCAPTCHA_MD.sql SQL Script in Added.Recaptcha.netFORUM project /SQL Scripts/ folder
- Update reCAPTCHA-PublicKey, reCAPTCHA-PrivateKey, and reCAPTCHA-Enabled system options from iWeb with the values specified by your Google reCAPTCHA Account. Note: Site Key and Public Key are synonymous. Important: the reCAPTCHA-PrivateKey is encrypted so it must be updated through iWeb and not a SQL Script. Also, this value should not be shared.
- Download or Clone Repo
- Build Added.Recaptcha.netFORUM Project
- Copy Added.Recaptcha.dll and Added.Recaptcha.netFORUM.dll to /eWeb/bin/ directory
- Copy contents of Added Recaptcha.netFORUM project /Scripts/AddedInnovation/* to your eWeb Site Root/Scripts/AddedInnovation
- Execute reCAPTCHA_MD.sql SQL Script in Added.Recaptcha.netFORUM project /SQL Scripts/ folder
- Update reCAPTCHA-PublicKey, reCAPTCHA-PrivateKey, and reCAPTCHA-Enabled system options from iWeb with the values specified by your Google reCAPTCHA Account. Note: Site Key and Public Key are synonymous. Important: the reCAPTCHA-PrivateKey is encrypted so it must be updated through iWeb and not a SQL Script. Also, this value should not be shared.
- Add Form Extension to form
- Control Class: Div
- Control ID: addedRecaptcha (name it whatever you want)
- Object Assembly: Added.Recaptcha.netFORUM
- Oject Typename: Added.Recaptcha.netFORUM.RecaptchaExtensions
- See V2 reCAPTCHA and Invisible reCAPTCHA below for Methods
- Add form extension control to form (Form Designer) in the location it should display
- Load Method: OnLoad_RenderRecaptcha
- Load Parameters: Page:Page;Control:Control
- Before Save Method: BeforeSave_ValidateRecaptcha
- Before Save Parameters: Page:Page;Control:Control
- Load Method: OnLoad_RenderInvisibleRecaptcha
- Load Parameters: Page:Page;Control:Control
- Before Save Method: BeforeSave_ValidateRecaptcha
- Before Save Parameters: Page:Page;Control:Control
- Navigate to wizard buttons which should trigger invisible reCAPTCHA
- Add "invoke-recaptcha" css class to all wizard buttons which should trigger reCAPTCHA
To deal with the Back to top button and the Invisible reCAPTCHA overlap, you can use the following code to move the reCAPTCHA out of the way of the back to top button:
Note: there are curly braces that are netFORUM-escaped with [| or |] to be able to be dropped into an eWeb page detail easily.
<script type="text/javascript">
var handler = function () [|
var offset = 20; // offset used by FormFunctions for the Back To Top link.
var duration = 400; // duration used by FormFunctions for the Back To Top link.
var enabled = false;
function _tryAttach() [|
if($('.grecaptcha-badge').length == 0) [|
window.setTimeout(_tryAttach, duration);
|]
else [|
window.setTimeout(function () [|
_handler();
$(window).scroll(_handler);
|], duration);
|]
|];
var _handler = function () [|
if (enabled === false && $(window).scrollTop() > offset) [|
enabled = true;
$('.grecaptcha-badge').animate([| bottom: '100px' |], duration);
|]
else if (enabled === true && $(window).scrollTop() <= offset) [|
enabled = false;
$('.grecaptcha-badge').animate([| bottom: '14px' |], duration);
|]
|];
_tryAttach();
|]
if (typeof (Sys) !== 'undefined' && typeof (Sys.WebForms) !== 'undefined' && typeof (Sys.WebForms.PageRequestManager) !== 'undefined') [|
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(handler);
|]
else [|
$(handler);
|]
</script>