Select Option

I have a Select option list. It has 3 options : opt_A, opt__B, and opt_C with value 0, 1, and 2 respectively.

If use selects opt_A its value should be updated to the database and in view part the opt_A should be selected automatically.

But it won’t work in my system. Can you suggest me.


foreach($objectEntity as $field) {


 <div class="row">				

	<?php echo $form->label($model, $field['entityId']);?>


           // retrieves current status of the user from database


	echo CHtml::dropDownList($model->privacyStatus,'', $model->getPrivacyStatusOptions(), // display status list


	          	 'ajax' => array(

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

			  'url'=>CController::createUrl("privacyStatus&o=".$field['objectId']."&e=".$field['objectEntityId']), //url to call.

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

			 //'update'=>'#city_id', //selector to update


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





} //foreach loop 

Read: You can specify which item should be selected.

Another option would be to use an activeDropDownList():

Just like:

CHtml::activeDropDownList($model, 'privacyStatus', $model->getPrivacyStatusOptions(), array(

                         'ajax' => array(




Ya I did the same.

Thanks for your suggestion.