Hi, I’m new to this forum and Yii. Here’s my question as posted at stackoverflow.com but got no answers:
I’m using Yii, and used the Gii code generator to generate a form from a Model.
I’m loading the view this way:
public function actionIndex()
{
$this->render( 'index', array(
'form'=> $this->renderPartial( 'the_form', NULL, true )
) );
}
The form view is structured this way:
<?php $form = $this->beginWidget('CActiveForm', array(
'id'=>'the_form',
'enableAjaxValidation'=>false,
)); ?>
<div class="row">
<?php echo $form->textField($model,'IdUser'); ?>
<?php echo $form->error($model,'IdUser'); ?>
</div>
[...]
But I get an error from the textField() method:
get_class() expects parameter 1 to be object, null given
At: /yiiframework/web/helpers/CHtml.php(1894)
Stack trace:
#0 /yiiframework/web/helpers/CHtml.php(1894): get_class()
#1 /yiiframework/web/helpers/CHtml.php(1870): resolveName()
#2 /yiiframework/web/helpers/CHtml.php(1164): resolveNameID()
#3 /yiiframework/web/widgets/CActiveForm.php(374): activeTextField()
#4 /protected/views/resume/resume_form.php(11): CActiveForm->textField()
Ok, the question would be: what’s wrong and how can I fix it?
link: http://stackoverflow.com/questions/3219875/
Thanks!