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.
<?php
foreach($objectEntity as $field) {
?>
<div class="row">
<?php echo $form->label($model, $field['entityId']);?>
<?php
// retrieves current status of the user from database
$model->privacyStatus=Privacy::checkStatus($field['objectEntityId'],$field['objectId']);
echo CHtml::dropDownList($model->privacyStatus,'', $model->getPrivacyStatusOptions(), // display status list
array(
'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
//'data'=>'js:{objectId:$("#frm").val()}'
//leave out the data key to pass all form values through
)));
?>
</div>
<?php
} //foreach loop