YII - renderPartial gives error with CActiveForm

Hi friends, i am trying to include form on product page using renderPartial but it gives error

Fatal error: Call to a member function getErrors() on a non-object in /Applications/MAMP/htdocs/yii/framework/web/helpers/CHtml.php on line 1605

i am using below code…

in product page


// product detail goes here, use below form to make an inquiry about this product

<?php $this->renderPartial('inquiry'); ?>



and in inquiry page page




<?php $form=$this->beginWidget('CActiveForm', array(

    'id'=>'query-form',

    'enableClientValidation'=>true,

    'clientOptions'=>array(

        'validateOnSubmit'=>true,

    ),

)); ?>




    <?php echo $form->errorSummary($model); ?>


    <div class="row">

        <?php echo $form->labelEx($model,'name'); ?>

        <?php echo $form->textField($model,'name'); ?>

        <?php echo $form->error($model,'name'); ?>

    </div>

plz suggest me that what i am doing wrong

Hi,

I think that you forgot about passing model to template.

This:


// product detail goes here, use below form to make an inquiry about this product

<?php $this->renderPartial('inquiry'); ?>

Should look like this:


// product detail goes here, use below form to make an inquiry about this product

<?php $this->renderPartial('inquiry', Array('model'=>$model)); ?>

Where the $model variable should be instance of model class used in template.

hi, thanks :) it works now