Yii Framework Forum: Dynamically Changing Dropdownlist - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Dynamically Changing Dropdownlist Rate Topic: -----

#1 User is offline   shani 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 14-December 12

Posted 19 December 2012 - 03:30 PM

Attached File  dropdownlist.php (1.77K)
Number of downloads: 3
0

#2 User is offline   shani 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 14-December 12

Posted 19 December 2012 - 03:31 PM

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??
0

#3 User is offline   Rajith R 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 850
  • Joined: 20-April 11
  • Location:India

Posted 20 December 2012 - 01:28 AM

try echo something here

public function actionSlots()
{
echo 'test';
}


install firebug in firefox and look the console for errors.
Rajith Ramachandran,
Wiwo inc.
| Mobile: 919995504508
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users