0

I am trying out a simple program in Yii

// this is my model

<?php
class Create extends CFormModel
{   

    public $a;
    public $b;
    public $c;
    public $d;
    public $e;
    public $f;

    public function rules() {
        return array(
            array('a, b, c, d, e, f', 'required'),
            array('a, b, c, d, e, f', 'numerical', 'integerOnly' => true),
        );
    }
}



?>


// this is the action in my controller

 public function actionCreate()
    {
                $model = new Create;
        $this->render('create',$model);
    }

// this is my view


    <?php
     $form=$this->beginWidget('CActiveForm'); 
     echo $form->textField($model,'a');
     $this->endWidget(); 
    ?>

I am getting this error..

Fatal error: Call to a member function getValidators() on a non-object in C:\xampp\htdocs\crudyii\framework\web\helpers\CHtml.php on line 2236

Thanks in advance.

4

1 回答 1

4

Try

$this->render('create', array('model' => $model));
于 2013-09-11T08:26:30.623 回答