I am using the ASP.Net plugin and control provided by reCAPTCHA. I can successfully get the control to work if the submit button on the web form is not in a validationgroup. There is no validationgroup attribute for the reCAPTCHA control.
Has anybody had any success with this or any solutions to get the reCAPTCHA control to work when there is a validationgroup on the web form?
Thought I'd just expand on the comments by a few others with some working code...
<recaptcha:RecaptchaControl ID="RecaptchaControl" runat="server" />
<asp:CustomValidator ID="RecaptchaValidator" runat="server" OnServerValidate="RecaptchaValidator_ServerValidate" ErrorMessage="Recaptcha input invalid." ValidationGroup="SomeValidationGroup" />
And code behind...
protected void RecaptchaValidator_ServerValidate(object sender, ServerValidateEventArgs e)
{
this.RecaptchaControl.Validate();
e.IsValid = this.RecaptchaControl.IsValid;
}
Can anyone think of a simpler way of doing it? Kudos to Vidalik for the thoughts about using OnServerValidate.