Data Is Not Maintained In Update Function

i use ajax dropdown function for getting categories from types its working fine But problem is that when i am going to update my record the data is not maintained, it’s says me again to select dropDown value

here is my code


<div class="row">

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

			<?php  echo CHtml::dropDownList('type_id','', $list1,

			array(

			  'empty'=>'Select a Type', '',

				'ajax' => array(

				'type'=>'POST',

				'url'=>CController::createUrl('entries/categorybytype'),

				'update'=>'#cate_id',

				)	

			)

			);   

			?>

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

	</div>

	


	<div class="row">

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

		<?php // echo  $form->dropDownList($model, 'cate_id', $list, array('empty' => 'Select a state'));  ?>

		<?php echo CHtml::dropDownList('cate_id','', array('empty' => 'Select a state'));    ?>

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

	</div>

‘type_id’ dropDown is not tied to the $form, hence to being assigned to an attribute, hence not being saved…




 <?php echo $form->dropDownList($model,'mfg_id',

			CHmtl::listData(Companies::model()->findAll(array('order' => 'name ASC')), 'id', 'name'),

			array(

			'class'=>'form-control select2me select2-offscreen',

			)); ?>

Do it like this and if it’s not related put your data source where Companies::model … is