CGridView delete button

Hi

I have a form with 2 CGridViews.

The update button of one of the gridviews, runs a javascript function that opens a CJuiDialog.

The CJuiDialog contains an additional form with a 3rd CGridView. This 3rd gridview’s button calls the correct controller action, but it results in a GET request instead of POST.

I can’t find any conflicts in button names.

Here is the button’s code.




array(

	'class'=>'CButtonColumn',

	'template'=>'{detach-btn}',

	'id'=>'form-button-column',

	'buttons' => array(

		'detach-btn' => array(

			'label'=>'Detach',

			'url'=>'array("DeleteJunctionTableRecord", "id"=>$data->branch_role_permission_id)',

			'imageUrl'=>Yii::app()->request->baseUrl.'/images/css/gridview/delink.png',

			'confirmation' => "Are you sure you want to detach this Permission from the Role?\n\n (Neither the Permission nor the Role will be deleted. Only the link between them will be deleted.)",

		),

	),

),



Note1: I can find ‘form-button-column’ in Firebug HTML, but I can’t find detach-btn.

Note2: Everything worked OK before I placed the additional form in a CJuiDialog.

Thanx

I think I have to work through the ajax that opened the dialog. That ajax must post to the controller after picking up the CGridView click event.

I isolated the error:

I have two delete buttons in the gridview and thus needs to rename one of them.

This works:


'class'=>'CButtonColumn',

'template'=>'{delete}',

'buttons' => array(

	'delete' => array(

		'url'=>'array("DeleteJunctionTableRecord", 

		"id"=>$data->branch_role_permission_id)',

	),

),



This does not work and produces the error “Invalid request. Please do not repeat this request again.” (I only changed ‘delete’ to ‘delete2’):


'class'=>'CButtonColumn',

'template'=>'{delete2}',

'buttons' => array(

	'delete2' => array(

		'url'=>'array("DeleteJunctionTableRecord", 

		"id"=>$data->branch_role_permission_id)',

	),

),



I guess ‘delete’ uses default yii functions that create a POST request, while ‘delete2’ creates a GET request.

How do you make your custom button produce a POST request?