By default, on two of my installs of reCAPTCHA Plugin for WordPress – v2.7, I receive no error message if the captcha is entered incorrectly… the user of the weblog is to assume that they made a mistake I guess…
That is until I wrote this script to check for error messages being passed around on the URL by the plugin:
if (window.location.search != "") { var searchArray = window.location.search.split("&"); for (var i=0; i < searchArray.length; i++) { var searchSubArray = searchArray[i].split("="); if (searchSubArray[0] == "rerror" && searchSubArray[1] == "incorrect-captcha-sol") { document.write("<p>The two words in the picture were typed incorrectly.</p>"); } } }
Just drop that snippet into your “comments.php” template. When the captcha is filled in incorrectly, the plugin adds “rerror=incorrect-captcha-sol” to the url. This checks for that string, and if found, writes an error message in red.
Couldn’t you do something like this:
if (location.search.indexOf(“&rerror=incorrect-captcha-sol”) > 0)
?
I am sure Yeah that works… and is much more eloquent. ;-)