jeudi 23 juin 2016

Yii ajax dropdown list not working

hello im so confused with my problem the problem is the ajax didnt update the valuescreenshot while i choose kegiatan ajax didnt react/update. idk were the error please help me this my controler code public function actionDynamiclocation() { $data=Kegiatan::model()->findAll('nid=:nid', array(':nid'=>(int) $_POST['nid'])); $data=CHtml::listData($data,'nid','lokasi','pengajuan','realisasi'); foreach($data as $value=>$name) { echo CHtml::tag('option', array('value'=>$value),CHtml::encode($name),true); } } public function actionAjaxCreate() {$model=new Reportbean; $outlets = Kegiatan::model()->findAll('nid=:nid', array(':nid'=>(int) $_POST['nid'])); $model->lokasi=0; $model->pengajuan=1; $model->realisasi=2; $this->renderPartial('_keg ', array('model'=>$model),false,true); } and view code <div class="row"> <?php echo $form->labelEx($model,'kegiatan'); ?> <?php echo $form->DropDownList($model,'kegiatan', array(), array( 'empty'=>'--pilih--', 'ajax' => array( 'type'=>'POST', //request type 'url'=>CController::createUrl('Reportbean/ajaxCreate'), //url to call. 'data'=>array('nid'=>'js:this.value'), 'update'=>'.outlet', //'update'=>'#'.CHtml::activeId($model,'lokasi'), //selector to update //'data'=>array('nid'=>'js:this.value'), ))); ?> <div class="outlet"> <?php $this->renderPartial('_keg', array('model'=>$model),false,true); ?> </div> <?php $this->widget('zii.widgets.CDetailView', array( 'data'=>$model, 'id'=>'keg', 'attributes'=>array( 'lokasi', 'pengajuan', 'realisasi', ), )); ?>

Aucun commentaire:

Enregistrer un commentaire