I have a form for a model, which contains some related fields. When one field is changed, some other ones are also validated and can contain errors. AJAX validation is enabled.
Currently the only one error is shown - the error (if any) for the field which was edited right now. This looks like an algorithm coded by design - in fact the file jquery.yiiactiveform.js contains the following code in validate callback:
$.each(settings.attributes, function ()
{
if (this.status === 2 || this.status === 3)
{
hasError = $.fn.yiiactiveform.updateInput(this, data, $form) || hasError;
}
});
So, this.status is always 1 ("validated") for all attributes except for the one that has been changed most recently, and thus updateInput is skipped for all other fields.
As a consequence, if, for example, you change the field "name", and ajax validation responce contains the following data:
{"alias":["Your alias is incorrect!"]}
it does not highlight the "alias" field and does not show its error message.
The question is: is there a way to tell Yii to highlight validation errors on all fields?