I have 3 dependent drop-downs, data is populated in all of them. But when i select 1st dropdown, (its dependant dropdown) 2nd dropdown populates but it does not populate the 3rd dropdown. I have to click the value in 2nd dropdown for population of values in 3rd dropdown.
I want that 3rd dropdown to be automatically populated on population of 2nd dropdown.Is it possible?
<div class="row">
<?php echo $form->labelEx($model,'province_id'); ?>
<?php echo $form->dropDownList($model, 'province_id', $model->getProvinces(), array(
'prompt' => '–--Select Provinces--–',
'ajax' => array('type' => 'POST',
'url' => CController::createUrl('candidate/district'),
'update' => '#'.CHtml::activeId($model,'district_id'),
'data' => array(
'province_id' => 'js:this.value',
),
)
));
?>
<?php echo $form->error($model,'province_id'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'district_id'); ?>
<?php
$dist1 = CHtml::listData(District::model()->findAll('id= :district_id',
array(':district_id'=>$model->district_id)), 'id', 'name');
echo $form->dropDownList($model, 'district_id', $dist1, array(
'prompt' => '–--Select District--–',
'ajax' => array('type' => 'POST',
'url' => CController::createUrl('candidate/county'),
'update' => '#'.CHtml::activeId($model,'county_id'),
'data' => array(
'district_id' => 'js:this.value',
),
)
));
?>
</div>
<div class="row wide">
<?php echo $form->labelEx($model,'county_id'); ?>
<?php echo $form->dropDownList($model,'county_id', CHtml::listData(County::model()->findAll('id= :county_id',
array(':county_id'=>$model->county_id)), 'id', 'name')
); ?>
</div>