May 6, 2011

jquery recaptcha php

Question by dave

I don’t know how can i validate the recaptcha thing via jQuery. Please help. I have the contact us form with the following fields:

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.validate.js"></script>


<script type="text/javascript">

$(document).ready(function() {

$('#signup').validate({
rules: {
name: {
required: true
},
email: {
required: true,
email: true
},
messages: {
name: {
required: 'FULL NAME Missing'
},
email: {
required: "E-MAIL ADDRESS Missing",
email: "E-MAIL ADDRESS Not Valid"
}

});



});


</script>

<form action="index.php" method="post" name="signup" id="signup">
<p>
Full Name
<br>
<input name="name" type="text" class="required" id="name" title="Type your Full Name into this box" value="<?php echo $_POST['name']; ?>">
</p>
<p>
E-Mail Address
<br>
<input name="email" type="text" id="email" title="Type your E-Mail Address into this box" value="<?php echo $_POST['email']; ?>">


</form>

Validation with the jQuery is working, but no idea how to implement the recaptcha into this.

Answer by dave

thanks all for your comments,will get it done by simple library 🙂

http://www.white-hat-web-design.co.uk/articles/php-captcha.php

And validation by using php after submitting of the form (it was easy for me to implement in less time in php than jquery. 🙂 .

special thanks to Felix Kling :).

Dave

Answer by Starx

For those sort of validate, there is a validation method in jQuery validate plugin known as remote.

Check it here

$("#myform").validate({
  rules: {
    email: {
      required: true,
      email: true,
      remote: "check-email.php"
    }
  }
});

In this check-email.php should return string “true” to be considered valid. and string “false” to be considered false.

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!