Reload dropDownList datasource with ajax

Hi all!

I use two dropDownList in a CActiveForm (the different between the dropdownlists only the id and datasource):




<?php echo $form->dropDownList

  (

    $model,

    'image_group_id',

    CHtml::listData($model->getGroups(),'image_group_id','image_group_name'),

        array('prompt'=>Yii::t('layout','Please select'))

  );

?>



My problem is, when I change the second dropdownlist, I want to reload the first dropdown source in the background.

I found something about how to attach ajax request to the dropdownlist, but I not found how can I reload source when another dropdown changed(or another textbox blured, etc.).

In PRADO I used TActiveDropDownlist and in ajax call function I called $this->ID->setDataSource(), so I try to use $form->activeDropDownList, but CActiveForm doesn’t contain that.

Anybody can help me?

Thanks

http://www.yiiframework.com/wiki/24/creating-a-dependent-dropdown/

Ooo, thank you!