I am getting…Fatal error: Call to a member function getErrors() on a non-object in /Applications/XAMPP/yii/framework/web/helpers/CHtml.php on line 1705. Please give me some guidance thanks.
I have a view company.php
<?php $this->widget('bootstrap.widgets.TbTabs', array(
'type'=>'tabs',
'placement'=>'left',
'tabs'=>array(
array('label'=>'About','content'=>$this->renderPartial('about', array('model'=>$model), true), 'active'=>true),
array('label'=>'Contact','content'=>$this->renderPartial('contact', array('model'=>$model), true)),
),
)); ?>
Then from yiic generated code I have SiteController.php
/**
* Displays the contact page
*/
public function actionContact()
{
$model=new ContactForm;
if(isset($_POST['ContactForm']))
{
$model->attributes=$_POST['ContactForm'];
if($model->validate())
{
$headers="From: {$model->email}\r\nReply-To: {$model->email}";
mail(Yii::app()->params['adminEmail'],$model->subject,$model->body,$headers);
Yii::app()->user->setFlash('contact','Thank you for contacting us. We will respond to you as soon as possible.');
$this->refresh();
}
}
$this->render('contact',array('model'=>$model));
}
And yiic generated contact.php
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'contact-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?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>