Sumith Chalil
Sumith Chalil

Reputation: 358

yii dependent dropdown is not working

This is my view page

<?php echo $form->dropDownListRow($order,'area_id',Area::model()->getActiveAreaList(),
array(
'ajax' => array(
'type'=>'POST', //request type
'url'=>CController::createUrl('currentController/getdeliveryforarea'), 
'update'=>'#pickup_time_slot', //selector to update
'data' => array('area_id' => 'js:this.value',),
))); 
?>
<?php echo $form->dropDownListRow($order,'pickup_time_slot',array(),array('prompt'=>'Select time')); ?> 

and in my controll the getdeliveryforarea is like

public function actionGetdeliveryforarea()
        {
            $data=Areatimeslot::model()->findAll('area_id=:area_id', 
                          array(':area_id'=>(int) $_POST['id']));

            $data=CHtml::listData($data,'id','name');
            foreach($data as $value=>$name)
            {
                echo CHtml::tag('option',
                           array('value'=>$value),CHtml::encode($name),true);
            }
        }

here my dependent dropdown is not working ,from getActiveAreaList i will get the area list in first dropdown and once i choose an area it must show corrosponding time list in second dropdown,i hope someone will help me out,thanks in advance

Upvotes: 0

Views: 92

Answers (1)

Insane Skull
Insane Skull

Reputation: 9368

Use Juqery migrate plugin or try something like,

jQuery.browser = {};
(function () {
  jQuery.browser.msie = false;
  jQuery.browser.version = 0;
  if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
    jQuery.browser.msie = true;
    jQuery.browser.version = RegExp.$1;
  }
})();

Upvotes: 1

Related Questions