CActiveForm Ajax Validation

  1. Regarding validateOnChange:

You may want to turn this off if it causes too much performance impact, because each AJAX validation request will submit the data of the whole form. Defaults to true.

Any reason why the whole form is submitted in this case? Any way to make it submit only the field that loses focus?

I checked using Firebug and found that the errors are returned in the JSON response for all fields, though the errors don’t actually get displayed on the page.

  1. When using validateOnChange, if a "required" field loses focus without any value entered/selected it will give you an error (cannot be empty). Ideally it would be good if required fields are only validated with validateOnSubmit. This way, for example if a user is just inspecting the form they will not get any errors. Is it possible to do it this way?

You can achive the second point by by creating some special rules (without required) for a new scenario "onAjaxValidation".

You can set this scenario in the controller by checking if is an ajax request.

For the first point I have no simple anser… except editing all the code of the ajax validation.