Search code examples
phpyiiframeworksphp-5.3

include(password.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory


i am a newbie in yii framework its been just 4 days i am stuck in this problem can someone help me below is my code..

this is view ...

<div class="form">
<?php echo CHtml::beginForm(); ?>

<?php echo CHtml::errorSummary($model); ?>

<div class="row">
    <?php echo CHtml::activeLabel($model,'email'); ?>
    <?php echo CHtml::activeEmailField($model , 'email') ?>

</div>  

<div class="row">
<?php  echo CHtml::activeLabel($model, 'password'); ?>
<?php  echo  CHtml::activePasswordField($model, 'password');  ?>

</div>
 <?php echo CHtml::endForm(); ?>    

my simple code for model

<?php
class C_regsiter extends CFormModel{

public $username;
public $Password;
public $email;
public $data; 
protected  $id;

public function rules(){

return array(

array('username','password','email','required'),
array('email','email'),      

);

 }

public function attributelabel(){


 return array(

 'username'=>'User Name',
 'Password'=>'Password',
 'email'=>'Email Address '

); 

}

}

this is my controller

class RegisterController extends Controller
{
 public function actionIndex()
 {
  $model=new C_regsiter();
  $this->render('index',array('model'=>$model));

 }

the problem is whenever is call the activepasswordfield is got an error please help


Solution

  • This is about Yii 1 right? Check your models rules definition. The "required" notation is wrong. It should be array('username, password, email', 'required'),

    First element should be the attributes, second the validator. array('attribute list', 'validator name', 'on'=>'scenario name', ...validation parameters...)

    See the documentation.

    What your code tried to do: It takes the second element as a validator class, which it tries to include, but you don't have such a file, hence the include error.