ActiveForm Validation Filter
EActiveFormValidationFilter performs validation of active form. To AJAX validation with CActiveForm, we can use this filter.
Installing and configuring your controller
public function filters() { return array( array( 'ext.yiiext.filters.activeFormValidation.EActiveFormValidationFilter[ +|- Action1, Action2, ...]', // The single primary CModel class name or array of classes model. // The EActiveFormValidationFilter::getModelsInternal() method will return a models of this classes. 'models'=>array( 'ModelClassToBeValidate', // Set model name SecondModel:model()->findByPk(1), // Set model instance array('modelClass'=>'ThirdModel','scenario'=>'update','isNewRecord'=>true), // Set model name and scenario ), // Id of the form 'formId'=>'form', // The name of the parameter indicating the request is an AJAX request. 'ajaxVar'=>'ajax, ), ); }
Changelog
0.4 [] Change models scenario defaults to 'ajax-actionId'. [] Change formId defaults to 'actionId-form', where 'actionId' is the action ID being filtered by this filter.
0.3 Warning: this version is not backwards compatible to 0.2. [*] Change method of setting up a models.
0.2
[+] Support to set model instances.
[*] Fix supporting array of model.
0.1 [+] Initial public release.