<?php/** * This is the template for generating the action script for the form. * The following variables are available in this template: * - $modelClass: the model class name * - $viewName: the name of the view */?><?php$actionName=$modelClass;if(strrpos($modelClass,'Form')===strlen($modelClass)-4)$actionName=substr($modelClass,0,strlen($modelClass)-4);?>public function action<?phpecho$actionName;?>(){ $model=new <?phpecho$modelClass;?>; // uncomment the following code to enable ajax-based validation /* if(isset($_POST['ajax']) && $_POST['ajax']==='<?phpecho$this->class2id($modelClass);?>-form') { echo CActiveForm::validate($model); Yii::app()->end(); } */ if(isset($_POST['<?phpecho$modelClass;?>'])) { $model->attributes=$_POST['<?phpecho$modelClass;?>']; if($model->validate()) { // form inputs are valid, do something here return; } } $this->render('<?phpecho$viewName;?>',array('model'=>$model));}