Perform Validation For A Specific Field

Hi,

I wanted to perform validation for a specific form input field, and i couldn’t find a solution until i came up with the following.

this is working for me , so if you guys have any comments or improvements , please let me know.





//Using the function 

performValidation($(this).closest("form"), $(this).attr('id'));


// perform specific field validation //

performValidation: function($form, inputId) {

        var settings = $form.data("settings");

        $.each(settings.attributes, function() {

            if (this.id === inputId)

                this.status = 2;

        });

        $form.data("settings", settings);


        // trigger ajax validation

        $.fn.yiiactiveform.validate($form, function(data) {

            $.each(settings.attributes, function() {

                if (this.id === inputId) {

                    $.fn.yiiactiveform.updateInput(this, data, $form);

                    return;

                }

            });

            $.fn.yiiactiveform.updateSummary($form, data);

        });

    },