Ajaxsubmitbutton Not Passing Parameter

Hi, I have a problem using bootstrap modal for updating data.

On CGridView selectionChanged, it will trigger a function to show modal dialog form and insert the data to the form

Here is my CGridView :



$this->widget('customCGridView', array(


                    'itemsCssClass' => 'table table-bordered',


                    'dataProvider' => $contactperson->search(),

                    'emptyText' => '',

                    'enableSorting' => false,

                    'htmlOptions' => array('class' => ' '),

                    'columns' => array(






On selectionChanged, it will trigger this script to open the update dialog modal and fill the form with selected CGridView column data :

function showmodal(grid_id) {


        var keyId = $.fn.yiiGridView.getSelection(grid_id);

        keyId  = keyId[0]; //above function returns an array with single item, so get the value of the first item



            url: '<?php echo $this->createUrl('suppliertable/personview'); ?>',

            data: {id: keyId},

            type: 'GET',

            success: function(data) {






Here is the actionPersonView which will be executed upon selecting column :

 public function actionPersonView($id) {


            $contactperson = SupplierContactPersonTable::model()->findByPk($id);

            if ($contactperson === null)

                throw new CHttpException(404, 'The requested page does not exist.');

            $this->renderPartial('updateForm', array('contactperson'=> $contactperson));              



Now, here is the problem :

When I Click update button on update form, I need to pass ID to my action :

public function actionPersonUpdate($id) {




                // Uncomment the following line if AJAX validation is needed

		// $this->performAjaxValidation($model);



                    if($model2 === null) {

                        throw new CHttpException(404, 'The requested page does not exist.');






To pass this value, I’m using AjaxButton on my form:

<div id="contact-person-modal">


$form = $this->beginWidget('CActiveForm', array(

    'id' => 'suppliercontactmodalform',

    'htmlOptions' => array(

        'class' => 'smart-form',

        'novalidate' => '1',


    'enableAjaxValidation' => false,





    <button type="button" class="btn btn-labeled btn-danger cancel-button" style="float: left">

        Hapus Pengguna



               echo CHtml::ajaxButton('Update', Yii::app()->createUrl('suppliertable/personupdate',array('id'=>$contactperson->contact_person_id)), array('type'=>'POST'), array('type'=>'submit',"class" => "btn btn-primary"));


    <button type="button" class="btn btn-default" data-dismiss="modal">





However, it seems like ID isn’t passed. Here is Firebug console :

POST http://localhost/webapp/index.php/suppliertable/personupdate/


400 Bad Request	

As you can see, no ID is passed

But, if I use static parameter value :

echo CHtml::ajaxButton('Update', Yii::app()->createUrl('suppliertable/personupdate',array('id'=>'5')), array('type'=>'POST'), array('type'=>'submit',"class" => "btn btn-primary"));

The ID is passed :

POST http://localhost/webapp/index.php/suppliertable/personupdate/5

So, I think the problem is here, is not outputing value :


Here is generated jQuery from Yii :

jQuery('body').on('click','#yt0',function(){jQuery.ajax({'type':'POST','url':'/webapp/index.php/suppliertable/personupdate?id=','cache':false,'data':jQuery(this).parents("form").serialize()});return false;});


Thanks for your help :)

Question updated, probably it is easier to identify. Thx :)