tags:

views:

16

answers:

0

I can't figure out how to make it so the form wont fire unless the realPerson captcha is "valid". I can see that when the user types in the correct/valid letters and clicks submit it adds a class of "valid" to the input. So Ive been trying to figure out how to get the jquery.validate plugin to only fire when the class "valid" is present.

 <script type="text/javascript">
 $(document).ready(function(){
  $('#defaultReal').realperson();

  $('#contact_form2').validate({

     submitHandler: function(form) {

  var str = $("form").serialize();
   $.ajax({
   type: "POST",
   url: "contactpage.php",
   data: str,
   success: function(){
        $('#contact_form2').html("<div id='message'></div>");
        $('#message').html("<h2>Contact Form Submitted!</h2>")
        .append("<p>We will be in touch soon.</p>")
        .hide()
        .fadeIn(1500, function() {
          $('#message').append("<img id='checkmark' src='images/check.png' />");
        });
      }});
  return false;

       }
 });

Thank you in advanced! -Dave