Hey everyone,
I have tried enabling reCaptcha to work on a website, it does appear BUT when the submit button is clicked and nothing is entered in reCaptcha the form is still submitted which shouldn’t happen.
This is the URL:-
http://kidsunlimi2.eweb102.discountasp.net/enquire-form.aspx
If you look at the bottom i need it to link with the form so if nothing is entered then it doesn’t submit?
On form submit i simply send an email.
Can anyone please help?
Thanks in advance.
I have. I used this tutorial. It is very is to follow. And you create your class once and can use it on every site in the future:
http://www.codeproject.com/KB/aspnet/CaptchaImage.aspx
Are you using the ASP.NET plugin? If not, use it. I had it up and running within an hour.
Cheers,
D.
Hey,
I am using the ASP.NET plugin. This is what i have done so far…
Downloaded the library from http://code.google.com/p/recaptcha/downloads/list?q=label:aspnetlib-Latest
Then i followed this http://recaptcha.net/plugins/aspnet/
Only thing i don’t understand is how to link the code to the form? I’m programming in C# and i have the following code:
protected void Button1_Click(object sender, EventArgs e)
{
string time;
time = "Evening";
MailMessage message = new MailMessage("enquiries@kidsunlimited.co.uk", "ABC.DEF@kidsunlimited.co.uk");
message.Subject = "Enquiry form request";
message.Body = "Please call " + DropDownList1.SelectedValue + " " +
txt_name.Text + ", in the " +
time + " available on " + txt_tel.Text
+ " or " + txt_email.Text +
". Enquiring about " + DropDownList3.SelectedValue +
", regarding the following nursery " +
DropDownList2.SelectedValue + ". Address is " + txt_address.Text +
", " + txt_postcode.Text + ". Any specific enquiry: " + txt_specific.Text + ".";
SmtpClient client = new SmtpClient("**********");
client.Send(message);
Response.Redirect("thanks.aspx");
}
And in the front end i have this to make the reCaptcha display:
<recaptcha:RecaptchaControl
ID="recaptcha"
runat="server"
PublicKey="6Lc-oQsAAAAAAOcQbs16sTt7OKAEGEdq0WOU8ghi"
PrivateKey="6Lc-oQsAAAAAABE5Mfa_AmND-4iwNh-QVLDtvQk_"
/>
So how can i prevent the form from being submitted if the recaptcha is not filled in?
Am i missing anything out? Or would i need to make a class as stated in #2?
Or better still do i need to add code to trigger the reCaptcha box so it knows that nothing has been entered?? If i used the class shown in #2, will it work with the reCaptcha box i have now?
Thanks again
Hey i fixed it,
I was simply missing If(Page.IsValid)… 
Thanks guys
I’d probably edit the above post and remove your public/private key values (unless you used made-up values). I don’t know that any real harm can come of it, but it’s probably not a good idea nonetheless.
Cheers,
D.
Call me OCD, but it’s not hard to make your own captcha, with classes already in the .NET Framework (ie Random). Then again, if you don’t have OCD I guess you shouldn’t invent fire again. Just thought it would be cool.
reCaptcha has the side benefit of helping to digitise books.
Cheers,
D.