I am having problem with my dependent dropdown, whenever I click update,
the current item that is being updated doesn’t pre-select the “city” from the dropdown based from it’s saved data from the table
<div class="row">
<?php echo $form->labelEx($model,'Country'); ?>
<?php
$country = new CDbCriteria;
$country->order = 'CountryName ASC';
?>
<?php
echo $form->dropDownList($model,'CountryID',CHtml::listData(Worldareascountries::model()->findAll($country),'CountryID','CountryName'),
array(
'ajax' => array(
'type' => 'POST',
'url' => CController::createUrl('wsmembersdetails/dynamicstates'),
'update' => '#Wsmembersdetails_'.StateID
)
)
);
?>
<?php echo $form->error($model,'CountryID'); ?>
</div><!--end country -->
<div class="row">
<?php echo $form->labelEx($model,'State'); ?>
<?php
$state = new CDbCriteria;
$state->order = 'StateName ASC';
?>
<?php
echo $form->dropDownList($model,'StateID',CHtml::listData(Worldareasstates::model()->findAll($state),'StateID','StateName'),
array(
'ajax' => array(
'type' => 'POST',
'url' => CController::createUrl('wsmembersdetails/dynamiccities'),
'update' => '#Wsmembersdetails_'.CityID
)
)
);
?>
<?php echo $form->error($model,'StateID'); ?>
</div><!--end state -->
<div class="row">
<?php echo $form->labelEx($model,'CityID'); ?>
<?php echo $form->dropDownList($model,'CityID',array());?>
<?php echo $form->error($model,'CityID'); ?>
</div><!--end city -->
is there something I should add or remove from this code snippet ?