Call to a member function getErrors() on a non-object

I got the blank rendered page and checked apache error log and saw this entry


[Tue Jun 01 19:19:55 2010] [error] [client 10.0.0.26] PHP Fatal error:  Call to a member function getErrors() on a non-object in /home/dmtrs/public_html/yii/framework/web/helpers/CHtml.php on line 1529



this happen before i


$form->errorSummary($person);

if i


var_dump($person);

just before i get the object.

Has anybody any idea???

Did not had the time to search for related issues will do later.

the error says that $form is not an object.

paste controller action and the view

The corect files are to my next post

From what I see…

In the update.php you call the _form.php with


<?php echo $this->renderPartial('_form', array('person'=>$person,'address'=>$address, 'update'=>true)); ?>

no ‘model’=>…

and in the _form.php you use a variable $model instead of $person or $adress

Sorry paste it wrong view

this is the proper one.

View/_form.php

Controller

view/update.php

Now

In your question you have


$form->errorSummary($person);

but in the source code you have


echo $form->errorSummary(array($person,$address));

and here $address is an array - not an object!

firstly if i remove the errorSummary line nothing happens either.

I have chnaged render to this in update action :


      $this->render('update',array(

                    'person'=>$person,

                    'address'=>$mainaddress,

            ));



At least there should not be the error "call to a member function getErrors() on a non-object"…

I noticed that in the update.php you have echo renderpartial… so you need renderpartial to return it’s value not to echo it…

check the renderpartial $return parameter - http://www.yiiframework.com/doc/api/CController#renderPartial-detail

you should set it to true, by default is false and renderpartial returns null in that case…

Found the problem was that $address==null when calling

i had the same problem i replaced forms with CHtml and solved