$form = $this->beginWidget('CActiveForm', array( 'id'=>'zdzone-form', 'enableAjaxValidation'=>true,//开启ajax验证 'enableClientValidation'=>true,//开启客户端验证,生成js 'action'=>'/manage/adzone/createadzone', )); ?>
//ajax数据验证 if(isset($_POST['ajax']) && $_POST['ajax']==='zdzone-form') { echo CActiveForm::validate($model); Yii::app()->end(); }