سلام خدمت اساتید
موقع اضافه کردن یوزر ولیدیشن ها کار میکنه ولی پسوورد ریپیت و وریفای کد وقتی درست هم میزنم همش ارور میگیره
کد rules:
public function rules() {
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('active_email, ssn, active_user', 'numerical', 'integerOnly' => true),
array('firstName_en, firstName_pe, lastName_en, lastName_pe, email, password', 'length', 'max' => 255),
array('firstName_en, firstName_pe, lastName_en, lastName_pe, email', 'required'),
array('password', 'required' , 'on'=>array('Add','changePassword')),
array('country, state, city, mobile_cell', 'length', 'max' => 150),
array('zipcode, phone, fax', 'length', 'max' => 100),
array('street_address', 'safe'),
array('email', 'unique'),
array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements(), 'on'=>array('Add')),
array('password', 'compare', 'on'=>array('changePassword','Add')),
array('password_repeat', 'safe', 'on'=>array('changePassword','Add')),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
array('id, firstName_en, firstName_pe, lastName_en, lastName_pe, email, active_email, password, country, state, city, street_address, zipcode, phone, fax, mobile_cell, ssn, active_user, date_create, date_update', 'safe', 'on' => 'search'),
);
}
کنترلر :
public function actionAdd()
{
$model=new Users;
$this->performAjaxValidation($model);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Users']))
{
$model->attributes=$_POST['Users'];
$model->scenario = 'Add';
if($model->validate()){
if($model->save(false))
Yii::app()->authManager->assign('owner',$model->id);
$this->redirect(array('site/index'));
}
}
$this->render('add',array(
'model'=>$model,
));
}
قسمت مربوط به پسوورد ریپیت و وریفای در ویو
<div class="form-group">
<?php echo $form->labelEx($model,'password_repeat'); ?>
<?php echo $form->passwordField($model,'password_repeat',array('class'=>'form-control','id'=>'input_form')); ?>
<?php echo $form->error($model,'password_repeat'); ?>
</div>
<div class="form-group">
<?php $this->widget('CCaptcha'); ?><br>
<?php echo $form->textField($model,'verifyCode',array('class'=>'form-control subject_Violations_verify','id'=>'input_form')); ?>
</div>
در مدل پسوورد ریپیت و وریفای هم پارامتر هاش رو تعریف کردم