How can I detect when jQuery Validation is done, and call something based on that event?

Viewed 22422

I'm new to jQuery.

Working with jQuery validation plugin & cufon at the same time is giving me really hard time.

Basically, I want to detect event once jQuery Validation did what it had to do and call Cufon.refresh() straight after it.

$('#commentForm').validate({
    rules: {
        password: {
            required: true,
            minlength: 8,
            maxlength: 8,
            number: true
        },
    }
});

We are expecting <label class="error"> SOME TEXT </label> when form is not valid.

And once that created I want to Cufon.refresh() on that label created by jQuery Validation. How can I detect when jQuery Validation is done, and call something based on that event?

Any help much appreciated. Regards, Piotr

6 Answers
$(document).ready(function() {  
    $('#commentForm').submit(function(){
        var validationResponse = $('#commentForm').valid();

        if(validationResponse) {
            // when true, your logic
        } else {
            // when false, your logic
            return false;
        }
    });

    $("#commentForm" ).validate({
        rules: {
            "first_name": {
                required: true
            }
        },
        messages: {
            "first_name": {
                required: "First Name can not be empty"
            }
        }
    });
});
Related