Hi,
I have a php script which uses the following line to submit a form :
<form action = "javascript:void(null);" onsubmit = "load_ajax();" name = "myform">
Now, to protect bots from misusing the form I want to implement reCAPTCHA as described here :
http://www.darksideofthecarton.com/2008/12/15/validating-recaptcha-with-jquery-and-ajax/
The reCAPTCHA logic is working fine displaying verification Success/Fail message but the form is not getting submitted. Here is the code I am using to implement reCAPTCHA :
<form action = "javascript:void(null);" onsubmit = "return validateCaptcha()" name = "myform">
Validation part which I am using to call my load_ajax() function (which denotes successful form submission) :
function validateCaptcha()
{
challengeField = $("input#recaptcha_challenge_field").val();
responseField = $("input#recaptcha_response_field").val();
//alert(challengeField);
//alert(responseField);
//return false;
var html = $.ajax({
type: "POST",
url: "ajax.recaptcha.php",
data: "recaptcha_challenge_field=" + challengeField + "&recaptcha_response_field=" + responseField,
async: false
}).responseText;
if(html == "success")
{
$("#captchaStatus").html("Success. Submitting form.");
return false;
// Uncomment the following line in your application
load_ajax();
return true;
}
else
{
$("#captchaStatus").html("Image verification failed, Pls. enter the image verification code correctly.");
Recaptcha.reload();
return false;
}
}
</script>
I am not a php/javascript expert so help is needed.
Thanks