3624
I want to change the contents of dropdownlist on the bases of other dropdownlist
I have 3 tables fst doctor , 2nd timeslot & 3rd appointment
I have the form in appointment in which i use
My code did not work properly
one dropdownlist is
<div class="row">
<?php echo $form->labelEx($model,'doctor_id'); ?>
<?php $doc = CHtml::listData(Doctor::model()->findAll(),'doctor_id','name');
echo $form->DropDownList($model,'doctor_id',$doc,
array(
'ajax' => array(
'type'=>'POST',
'url'=>CController::createUrl('Appiontment/Slots'),
'update'=>'#'.CHtml::activeId($model,'slot_id')
)));
?>
<?php echo $form->error($model,'doctor_id');?>
</div>
other dropdownlist is which contents will dynamically change
<div id="row">
<?php echo $form->labelEx($model,'slot_id'); ?>
<?php echo $form->dropDownList($model,'slot_id',array()); ?>
<?php echo $form->error($model,'slot_id'); ?>
</div>
In my appointment controller I use a function
public function actionSlots()
{
$doc_id = $_POST['Doctor']['doctor_id'];
$data = TimeSlot::model()->findAll('doctor_id=:doctor_id',
array(':doctor_id'=>$doc_id));
$data = CHtml::listData($data,'slot_id','timeslot');
foreach($data as $value=>$slot)
{
echo CHtml::tag('option',
array('value'=>$value),
CHtml::encode($slot),true);
}
}
I want to use timeslot of selected doctor in my appointment
Any one Any suggestion??
try echo something here
public function actionSlots()
{
echo 'test';
}
install firebug in firefox and look the console for errors.