Hi ,
I am facing problem managing dynamic widgets too.
The widget is as given below ,
class SiteWidget extends CWidget
{
public $siteId;
public $model;
public function run()
{
$this->model= new Site();
$this->loadSite();
$this->render('SiteTab',array('model'=>$this->model));
}
function loadSite()
{
if($this->siteId != null)
{
$this->model = Site::model()->find('id=:id',array(':id'=>$this->siteId));
}
}
}
The widget view 'SiteTab' contains the code shown below
<div class="form">
<?php echo CHtml::beginForm(); ?>
<?php
$form = $this->beginWidget('CActiveForm', array(
'id'=>'sitetab-form',
'enableAjaxValidation'=>false,
));
?>
<div class="div_body_content">
<?php echo $form->textField($model,'Site_Name',..)?>
<?php echo form->textField($model,'Site_Imp',..); ?>
</div>
<?php $this->endWidget(); ?>
<?php echo CHtml::endForm(); ?>
</div>
When a user enters the value for the first text field , this value has to be passed back to the widget , and the remaining fields in the widget have to be populated.
Please help me in achieveing this.
Thanks!