Validation - Remote validation marks a field as both "valid" and "error"

Validation - Remote validation marks a field as both "valid" and "error"

The title says it all. I am using jQuery Validation to validate a form. One field (a CAPTCHA field) is validated on the fly using remote validation. When the user types the correct code into the CAPTCHA field for the first time, the field is marked by jQuery validator as "valid" and "error" (I'm not sure how this is possible). If the user then clicks into the CAPTCHA field and then clicks/tabs out of the field, the erroneous "error" class is removed.

I think the issue must have something to do with remote validation because if I remove the remote validation then this does not happen (although this also means that the contents of the field are not validated so I'm not completely sure).

The link for the working example is http://ts1.abstractproductions.com.au/quote.php. Username and password are both "ts1".

The code for the jQuery validation is:
  1. <script type="text/javascript"> 
    <!--
    $(document).ready(function() {
    var validator = $("#quote_form").validate({
    rules: {
    name: "required",
    contact_method: "required",
    email: {
    required: true,
    email: true
    },
    confirm_email: {
    required: true,
    email: true,
    equalTo: "#email"
    },
    phone: {
    required: "#contact_method_phone:checked",
    phoneAU: true
    },
    quote_type: "required",
    hire_date: {
    dateITA: true
    },
    hire_duration: {
    required: "#quote_type_hire:checked",
    digits: true
    },
    hire_requirements: {
    required: "#quote_type_hire:checked"
    },
    production_event_date: {
    dateITA: true
    },
    production_description: {
    required: "#quote_type_production:checked"
    },
    other_requirements: {
    required: "#quote_type_other:checked"
    },
    securimage_code: {
    required: true,
    remote: {
    url: "include/php/check-securimage.php",
    type: "post"
    }
    }
    },
    messages: {
    name: "Please enter your name",
    contact_method: "Please select the method which you would prefer us to contact you",
    email: {
    required: "Please enter an email address",
    email: "Please enter a valid email address"
    },
    confirm_email: "The email addresses do not match",
    phone: {
    required: "Please enter a phone number or select a different contact method",
    phoneAU: "Please enter a valid Australian phone number (including area code)"
    },
    quote_type: "You must select a quote type",
    hire_date: "Please enter a valid date or leave this field blank",
    hire_duration: {
    required: "You must enter a duration for the hire",
    digits: "Hire duration must be a whole number"
    },
    hire_requirements: "Please describe your hire requirements",
    production_event_date: "Please enter a valid date or leave this field blank",
    production_description: "Please briefly describe your event and your requirements",
    other_requirements: "Please enter a message",
    securimage_code: {
    required: "You must enter the CAPTCHA code",
    remote: "The code you entered was incorrect"
    }
    },
    errorPlacement: function(error, element) {
    error.appendTo( element.parents(".field").next(".status") );
    element.addClass("error");
    },
    success: function(label) {
    // set &nbsp; as text for IE
    label.html("&nbsp;").addClass("checked");
    }
    });
    });
    //-->
    </script>






















































































The code for the PHP CAPTCHA checking script is:
  1. <?php
  2. require_once(dirname(__FILE__) . '/../library/securimage/securimage.php');
    $securimage = new Securimage();
    if ($_SESSION['securimage_code_value'] == strtolower($_POST['securimage_code']))
        echo "true";
    else
        echo "false";
    ?>