I have this form.
<div class="row">
<?php echo $form->labelEx($model,'type'); ?>
<?php echo $form->dropDownList($model,'type',Type::Group(),
array(
'empty'=>'',
'ajax' => array(
'type'=>'POST',
'url'=>CController::createUrl('price'),
'update'=>'#price .price',
)
));
?>
<?php echo $form->error($model,'type'); ?>
</div>
<div class="row">
<div id='price'><span>price: </span>
<span class='price'></span>
</div>
</div>
<div class="row">
<?php echo $form->labelEx($model,'my_list'); ?>
<?php echo $form->dropDownList($model,'my_list',$list); ?>
<?php echo $form->error($model,'my_list'); ?>
</div>
and this is my action
<?php
public function actionPrice(){
if(isset($_POST['Catalog']['type'])){
$id = $_POST['Catalog']['type'];
$modelOne = PriceCatalog::model()->findByPk($id);
$price = $modelOne->price * 2;
$models = Price::model()->findAllByAttributes(array(),'price_id=:price_id',array(':price_id'=>$priceID));
$array = array();
foreach($models as $model){
$array[$model->id] = $model->title;
}
$list = $array;
}
}
?>
I send to server
$_POST['Catalog']['type']
and then I want send from server $price and $list.
I must use $price in the span
<span class='price'></span>
and use $list for the another drop down list :
<?php echo $form->dropDownList($model,'my_list',$list); ?>
How can do this?