[jQuery] Form plugin and error validation

[jQuery] Form plugin and error validation


Hi all,
Is there a way I can stop resetForm: true from hitting when I deem
something is invalid via server-side validation? For example, here's
my ajaxForm object:
    $('#form2').ajaxForm(
        {
            target: '#container',
            type: 'post',
            resetForm: true,
        }
    );
And on the server-side I have a very rudimentary validation:
        if($error_message)
    {
        echo $error_message;
        exit;
    }
Is there anyway to tell ajaxForm when there is a logical error so that
success: and resetForm: are not executed. I understand those
parameters are there for successful AJAX responses, not logical
errors. I'm just not sure how to stop the form from resetting when I
have logical errors, however I do want this functionality to exist for
the form is indeed error free.
Thank you,
- sf