jQuery.yiiactiveform.js validation

Yii: 1.1.7

I’m manually firing off validation on a form.




    var button = $('#button'),

        form = $('#form').data('submitObject', button);


    button.click(function(event) {

        if (!event.originalEvent) { //Click was fired by validation

            //Ajax here etc...

            form[0].reset();

        } else //Click was fired by user interaction.

            form.triggerHandler('submit'); //Fire off form validation

    });



The above allows me to submit a form via ajax and use validation.

The problem is once the variable “validated” gets set it can’t be reset, so validation will never fire the click event again.

I think the "validated" variable should be reset back to false in the reset form event.