I'm attempting to add Google Recaptcha to a form.
I've got it displaying OK, but if the text is not entered correctly, then the form submits anyway. Not really the desired outcome.
I've added the regsiter tag to the top of the form:
<register tagprefix="recaptcha" namespace="recaptcha" assembly="recaptcha" />
I've added some script for validation (from my use of it on my DNN regsitration page:
<script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
<script type="text/javascript">
function reload_captcha() {
if ($(".dnnFormValidationSummary").length > 0) {
Recaptcha.create("6LekD_QSAAAAAC1yBipnjwREYsI8wYfWrlNA7sD2", "reCaptcha_widget",
{
theme: "red",
callback: Recaptcha.focus_response_field
});
}
}
</script>
I've add the div containers to display the image, which does work.
<div style="clear:both;">
<recaptcha:RecaptchaControl ID="recaptcha" PublicKey="{My Public Key]" PrivateKey="[My Private Key}" />
<img src="/spacer.gif" onload="reload_captcha();" />
</div>
<div id="reCaptcha_widget" style="display:none;"></div>