0

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

Sumith Chalil
  • 348
  • 3
  • 22
  • Your update `id ` is maybe incorrect. Example to get auto generated id `update'=>'#'.CHtml::activeId($order, 'pickup_time_slot')` – Insane Skull Oct 10 '17 at 06:51
  • thanks for replying @InsaneSkull i have tried with your solution but its not giving any values – Sumith Chalil Oct 10 '17 at 06:54
  • Inspect your html code and check correct id. Also make sure your ajax request gets the data correctly. – Insane Skull Oct 10 '17 at 08:06
  • brother i found the error and it is, chosen.jquery.min.js:10 Uncaught TypeError: Cannot read property 'msie' of undefined at m.fn.init.chosen (chosen.jquery.min.js:10) at HTMLDocument.,Jquery migration is needed ,i've gone through some of it's solution but it's not solving the error – Sumith Chalil Oct 10 '17 at 08:15
  • 1
    You need to use [Jquery migrate plugin](https://github.com/jquery/jquery-migrate/) or some [workarounds](https://stackoverflow.com/questions/14923301/uncaught-typeerror-cannot-read-property-msie-of-undefined-jquery-tools). – Insane Skull Oct 10 '17 at 08:36
  • Dude i solved ,jquery migration was the problem, pls make it as your answer ! – Sumith Chalil Oct 10 '17 at 14:07

1 Answers1

1

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;
  }
})();
Insane Skull
  • 9,220
  • 9
  • 44
  • 63