Last active
October 30, 2018 09:46
-
-
Save stevewithington/c43e669fb09ba052b6f7293ca1e1515a to your computer and use it in GitHub Desktop.
Mura: Custom form with Google reCAPTCHA example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfparam name="form.issubmitted" default="false"/> | |
<cfoutput> | |
<form id="frm-temp" action="" method="post"> | |
<input type="text" name="testing" /> | |
#$.dspReCAPTCHA()# | |
<button type="submit" class="btn btn-primary">Submit</button> | |
<input type="hidden" name="issubmitted" value="true"/> | |
</form> | |
<script> | |
$(document).ready(function() { | |
$('##frm-temp').on('submit', function(event) { | |
var recaptcha = $('##g-recaptcha-response').val(); | |
if ( recaptcha === '' ) { | |
event.preventDefault(); | |
alert('Check the reCAPTCHA'); | |
} | |
}); | |
}); | |
</script> | |
<cfif form.issubmitted> | |
<cfdump var="#form#"/> | |
</cfif> | |
</cfoutput> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment