摘要:
开启 ajax 验证view 层beginWidget('CActiveForm', array( 'id'=>'user-form', 'enableAjaxValidation'=>true, 'enableClientValidation'=>true, 'focus'=>array($model,'firstName'),)); ?>然后在控制器里面public function actionCreate(){ $model=new User; 阅读全文
摘要:
今天使用model rules 里面的 on 发现死活不起作用,后来搜索发现 需要设置model 实例的scenario 属性才能起作用,不知道为什么。//控制器内 $model = new User();$model->scenario = 'add';//模型内public function rules() { // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( array('username, pa 阅读全文