AjaxButton and DropDownList

i try to get selected value from the dropdownlist and send it through ajax button.

but somehow the ajaxbutton render it falsely, instead of the selected value from the dropdown, it send

the document.getElementById("kegiatan").value as whole string.


 echo CHtml::dropDownList('kegiatan', $kegiatan, $list, array('empty' => 'Jenis Kegiatan')); 


 echo CHtml::ajaxButton ("Update data", CController::createUrl('analisa_dampak/UpdateAjax'),


                        'update' => '#data',

                        'data'=> array('kegiatan_id' => 'document.getElementById("kegiatan").value')));


i tried to catch the POST as

public function actionUpdateAjax()


            $data["myValue"] = $_POST['kegiatan_id'];

            $this->renderPartial('_ajaxContent', $data, false, true);


i get the value but the value printed


instead of

1 or 2 or 3 (value of the drop downlist)

Just put a ‘js:’ before that like:


'data'=> array('kegiatan_id' => 'js:document.getElementById("kegiatan").value')));



I could not get a value with .value, so I’m using .val() like


'data'=> array('kegiatan_id' => 'js:document.getElementById("kegiatan").val()')));


weuhh thks. i spent hours solving this problem. :)