I want the content of my "installation_id" dropdownlist to change when I select something in the company_id dropdownlist. I have read similar problems in this forum and they have given me a few hints but I do not get this to work.
When I select something in the "company_id" dropdownlist nothing happens. In the code below I am trying a fixed value for the company_id.
Maybe someone can help me in the right direction here.
Here is some parts of my code:
StatuslogController.php :
public function actionloadInstallations()
{
$options = '';
$options = installations::model()->findAllByAttributes(array('companies.company_id'=>1));
$return = CHtml::listData($options, 'id', 'field_name');
return $return;
}
\views\statuslog\create.php
<div class="simple"> <?php echo CHtml::activeLabelEx($statuslog,'company_id'); ?> <?php echo CHtml::activeDropDownList($statuslog, 'company_id', CHtml::listData(companies::model()->Companies, 'id', 'name'), array( 'ajax' => array( 'type'=>'POST', 'url'=>'index.php?r=statuslog/loadInstallations', 'update'=>'#installation_id', ), )); ?> </div> <div class="simple"> <?php echo CHtml::activeLabelEx($statuslog,'installation_id'); ?> <?php echo CHtml::activeDropDownList($statuslog, 'installation_id', CHtml::listData(installations::model()->installations, 'id', 'field_name')); ?>