problem adding form to a worklet

hello there,

i get this error :

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

when i try to add form to a worklet


<?php

class WDealStatus extends UWidgetWorklet

{

	public $deal;

	

	public function accessRules()

	{

		return array(array('allow','users'=>array('*')));

	}

	

	public function taskConfig()

	{

		if(!$this->deal && isset($_GET['id']))

			$this->deal = MDeal::model()->findByPk($_GET['id']);

		if(!$this->deal)

			return $this->show = 0;	

		if(app()->request->isAjaxRequest)

			$this->layout = false;

	}

	

	public function taskRenderOutput()

	{

		if(!app()->request->isAjaxRequest)

		{

			cs()->registerScriptFile(cs()->getCoreScriptUrl().'/jui/js/jquery-ui.min.js');

			if(!app()->request->isMobile)

			{

				cs()->registerScriptFile(asma()->publish($this->module->basePath.DS.'js'.DS.'jquery.timers.js'));

				cs()->registerScript(__CLASS__.'#'.$this->deal->id,'$("#'.$this->getDOMId().'").uDealStatusPing("'.url('/deal/status',array('id'=>$this->deal->id)).'");');

			}

		}


		switch(wm()->get('deal.helper')->dealStatus($this->deal))

		{

			case 'active':

				$data = array(

					'bought' => $this->deal->stats?(int)$this->deal->stats->bought:0,

					'required' => (int)$this->deal->purchaseMin

				);

				$this->render('active',$data);

				break;

			case 'tipped':

				$this->render('tipped',array('bought'=>$this->deal->stats?(int)$this->deal->stats->bought:0));

				break;

			case 'closed':

				$this->render('closed',array('bought'=>$this->deal->stats?(int)$this->deal->stats->bought:0));

				$this->render('payback',array('model'=>$model));# <= this is the code generating the problem

				break;

		}

	}

}



i assume that i am using objects outside of a the form class

how to include it ?

Whats calling CHtml? we might need to see the view, but it is obviously that the model object is just null, may be it wasn’t found in the database.

payback.php (the view)


<div class="form">

<?php $form=$this->beginWidget('CActiveForm'); ?>

 

    <?php echo CHtml::errorSummary($model); ?>

 

    <div class="row">

        <?php echo CHtml::Label($model,'Firstname'); ?>

        <?php echo CHtml::textField($model,'firstname') ?>

    </div>

 

    <div class="row">

        <?php echo CHtml::Label($model,'Lastname'); ?>

        <?php echo CHtml::textField($model,'lastname') ?>

    </div>

 

    <div class="row">

        <?php echo CHtml::Label($model,'Paypal E-mail'); ?>

        <?php echo CHtml::textField($model,'paypalmail') ?>

    </div>

    

    <div class="row">

        <?php echo CHtml::Label($model,'Transaction ID'); ?>

        <?php echo CHtml::textField($model,'transactionid') ?>

    </div>

 

    <div class="row submit">

        <?php echo CHtml::submitButton('submit'); ?>

    </div>

 

<?php $this->endWidget(); ?></div><!-- form -->



and how to call Chtml ?

it seems $model variable isn’t defined

thats the fix =]