Dependent DropdownList Update action Issue

Need your help. I have a dependent drop downlist City that gets populated when user selects a State. Everything works great in create action. However, in the default update action the State dropdown gets populated with user submitted value however the City(dependent dropdown) remains blank. If select a different state then my city dropdown starts working again. How do I fix this without upsetting the working create action.


	<div class="row">

		<?php echo $form->labelEx($model,'state'); ?>

		<?php echo $form->dropDownList($model,'stateId',CHtml::listData(State::model()->findAll(), 'id', 'name'), array(

					'ajax' => array(

					'type'=>'POST', //request type

					'url'=>CController::createUrl('city'), //url to call.

					//Style: CController::createUrl('currentController/methodToCall')

					'update'=>'#' . CHtml::activeId($model, 'cityId'), //selector to update

						//'data'=>'js:javascript statement' 

					//leave out the data key to pass all form values through

					))); ?>

		<?php echo $form->error($model,'stateId'); ?>



	<div class="row">

		<?php echo $form->labelEx($model,'city'); ?>

		<?php echo $form->dropdownList($model,'cityId',array()); ?>

		<?php echo $form->error($model,'cityId'); ?>


controller.php controller name is Ticket

public function actionUpdate($id)



		// Uncomment the following line if AJAX validation is needed

		// $this->performAjaxValidation($model);











public function actionCity()




                  array(':id'=>(int) $_POST['Ticket']['stateId']));



    	foreach($data as $value=>$name)


        	echo CHtml::tag('option',





as the ajax part will be used only when user modify data, you must initialize the dependent dropdown in your form.