Passing Values To Custom Widget


I have a widget which fetches data from model.

class SiteTableWidget extends CWidget {


    public $siteId;

public function run() {

        $this->model= new Site();




function loadSite()


        if($this->siteId != null) 


           $this->model = Site::model()->find('id=:id',array(':id'=>$this->siteId));




The SiteTab view is this

<div class="form">

<?php echo CHtml::beginForm(); ?>

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



)); ?>

<div class="div_body_content">

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

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


<?php $this->endWidget(); ?>

<?php echo CHtml::endForm(); ?>


In another view I need to show this widget, however the content of the widget must be populated based on user input

<?php echo $form->textField($model,'Site_ID', array('onChange'=>'doSomethingToDisplaymyWidget','style'=>'width:100px;', 'autocomplete'=>'off')); ?>

When the user populates the ‘Site_ID’ textField(onChange event), I need to pass the value of the textField to my widget’s $siteId property.

How do I achieve this