Skip to content

Instantly share code, notes, and snippets.

@stevewithington
Last active October 30, 2018 09:46
Show Gist options
  • Save stevewithington/c43e669fb09ba052b6f7293ca1e1515a to your computer and use it in GitHub Desktop.
Save stevewithington/c43e669fb09ba052b6f7293ca1e1515a to your computer and use it in GitHub Desktop.
Mura: Custom form with Google reCAPTCHA example
<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