Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Google reCAPTCHA is accepting incorrect codes

Hello,

So I recently installed Google's reCAPTCHA on this site:

http://anaheimfeed.com (at the bottom in the footer section)

I've tried testing it out by putting an incorrect number and it sends me to a email subscription form of the site. Does anyone know why this would be happening?

Thanks for any help/ideas

2 Answers

It looks like your form is sent before the recapcha input was properly validated. So what you could do is add the recaptcha validation code to the code that validates your form.

I see you are using the Formmail script which is a cgi-script. There is a implementation guide on the Google Developers website that shows you how to implement Recaptcha with Formmail.

Ok thanks Sander - I will look at this

Allright, if you need any further help implementing the code just let me know.

Hi Sander,

So I've been trying to figure this issue out but with not much luck. I put my code on CodePen here:

http://codepen.io/thechasedesign/details/DKasq

The public key and private key are both correct so I'm not sure what else I need to do to fix this.

Thanks for any help you can provide.

Hi Brandon,

Didn't see your reply there. You are using PHP code to validate your Recaptha code in the form. You should use JavaScript like in the example on Google Dev https://developers.google.com/recaptcha/docs/formmail

So you first add the Javascript from the Google Dev example page to your form after the /** Validate captcha */ comment

After that, you change the Formmail script that is installed on your server: /cgi-bin/FormMail.subscribe.pl

Add all the example code and change the values for your public and private keys.

That should do it.

Do you mean the mailing list form? I do not see the recaptcha form. You should add the recaptcha code to the form for it to show. Here are some code examples

Sorry about that, I had actually taken it down but now it is back up....