Skip to content

Instantly share code, notes, and snippets.

@bowler865
Last active March 22, 2019 17:38
Show Gist options
  • Save bowler865/5c471956930b99f2724bca3082b3c02d to your computer and use it in GitHub Desktop.
Save bowler865/5c471956930b99f2724bca3082b3c02d to your computer and use it in GitHub Desktop.
Mura-Form-Recaptcha
<!---
Example of how to include the dsp_form_protect.cfm file which displays
the recaptcha if you have the site key and secret set in site settings.
--->
<div class="form-group<cfif listfindnocase(ErrorFields, "recaptcha", ";")> has-error</cfif>">
<div class="col-sm-12">
#m.dspObject_include(thefile='form/dsp_form_protect.cfm')#
<cfif listfindnocase(ErrorFields,"recaptcha",";")><span id="helpBlock" class="help-block">#Errors.recaptcha#</span></cfif>
</div>
</div>
<!---
If you have a form you are validating completely on your own
drop this into your validation file or method
This requires you to have the site key and secret set in site settings.
--->
<cfset recaptchaVerification = $.getBean('utility').reCAPTCHA($.event())>
<cfif !recaptchaVerification>
<cfset errors.recaptcha = "#$.rbKey('recaptcha.error')#">
<cfset ErrorFields = ListAppend(ErrorFields, "recaptcha", ";")>
</cfif>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment