Hope you are all good. I have a problem that is I have a dropdown list which shows number of packages. When I select one package then it’s price should be updated in the following field of the dropdown that is a text field’s value. But unfortunately, after a long try neither I can fix the issue nor find any solution over net. Please someone help me. I pasted my form and controller’s code here.
/*
* action for service package return packages correspondent service
*/
public function actionPackagePrice(){
// The following command does not work
$data = ServicePackage::model()->findByPk(array('id'=>$_POST['package_id']));
echo $data->price;
}
public function actionEventname(){
$venue_id=$_POST['venue_id'];
$data=VenueEvent::model()->findAll("rk_venue_id='".$venue_id."' AND status='1'");
$data=CHtml::listData($data,'id','event_name');
foreach($data as $value=>$event_name){
echo CHtml::tag('option', array('value'=>$value),CHtml::encode($event_name),true);
}
}
Thanks to reply. I have checked through firebug and found the response is correct that I got the price value. Just I can’t place that value(price) in the value of textfield correctly.