eactiveform Enhanced CActiveForm to do client-side javascript validation before sending ajax request

  1. Requirements
  2. Description:
  3. Usage:
  4. ChangeLog:
  5. NOTE:
  6. Reporting Issue:


Yii 1.1.1 ~ Yii 1.1.6 This feature has been integrated since version 1.1.7. See CActiveForm


This extension just extend from {link: CActiveForm} using few codes, it enhances the ajax validation.

  • Submit a list of changed attributes to php backend, then can access the attributes list in Controller via $_POST['attributes']['ModelName'] and verify these attributes only.
  • First to do client-side javascript validations before submission of ajax, and js validators converted from {link: CValidator} automatically.


Using this extension is same as original CActiveForm.

$form = $this->beginWidget('ext.EActiveForm');
// as same as normal CActiveForm codes

Controller example codes for verifying modified attributes only:

protected function performAjaxValidation($model)
  if (Yii::app()->request->isAjaxRequest && isset($_POST['ajax']))
    $class = get_class($model);
    if (isset($_POST['attributes']) && is_array($_POST['attributes'][$class]))
      $attributes = $_POST['attributes'][$class];
      $attributes = null;
    echo CActiveForm::validate($model, $attributes);


Nov 28, 2010

  • New version number 1.2
  • Enable ajax validation bye default(Override the property enableAjaxValidation)
  • Fixed issue on radiolist (thanks to ianare's report)
  • Fixed issue on incorrectly update error message for attributes when validate on submit.

Nov 14, 2010

  • New version number 1.1
  • Strict inspection validator is completely converted.
  • Add CTypeValidator support


For CRegualarExpressionValidator, please make sure Javascript compatible.

Reporting Issue:

Reporting Issues and comments are welcome, plz report them to offical extension page of Yii. Report issue

8 0
1 588 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Validation
Developed by: hightman
Created on: Nov 13, 2010
Last updated: 6 years ago
Update Extension
Manage Downloads


show all