I’m working on signup form and I have 2 steps to user register in some website, so step 1 is a create action and step 2 is update action on profile controller.
so my problem is how can preserve the selected country and city on validation error but it’s already ?! check the image

view:
<div class="row">
<?php echo $form->labelEx($model,'countryId'); ?>
<?php echo $form->dropDownList($model, 'countryId',
CHtml::listData(SysCountry::model()->findAll(), 'id', 'name'),
array(
'empty'=>'Select country',
'ajax' => array(
'type'=>'POST', //request type
'url'=>CController::createUrl('profile/dynamiccity'), //url to call.
//Style: CController::createUrl('currentController/methodToCall')
'update'=>'#Profile_cityId', //selector to update
//'data'=>'js:javascript statement'
//leave out the data key to pass all form values through
)));
?>
<?php echo $form->error($model,'countryId'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'cityId'); ?>
<?php echo $form->dropDownList($model, 'cityId', array('empty'=>'Please select country first')
); ?>
<?php echo $form->error($model,'cityId'); ?>
</div>
Check this, to update the second drop down you need to use