gnekkala
(Ngprasad20)
1
Hi,
I am passing parameters to actionDelete function. Could you please help me how to retrieve it?
Changed CButtonColumn to
array(
'class'=>'CButtonColumn',
'template'=>'{update}{delete}',
'buttons'=>array
(
'delete' => array
(
'url'=>'Yii::app()->createUrl("answers/delete", array("id"=>$data->id,"qid"=>$data->question_id,"oid"=>$data->ordering))',
),
),
),
actionDelete function like
public function actionDelete($id)
{
…
…
}
I need to retrieve qid and oid values in actionDelete function. I have tried like public function actionDelete($id,$qid,$oid) but it is not working.
Could you please help me how to retrieve it?
Thanks in Advance.
Thanks & Regards,
Gangadhar
diggy
(Digger A)
2
What is in your $_REQUEST ?
gnekkala
(Ngprasad20)
3
I didn’t get any request parameters. The action is working through Ajax.
diggy
(Digger A)
4
Then use firebug for debug your post requests.
mdomba
(Maurizio Domba Cerin)
5
gnekkala
(Ngprasad20)
6
I am using default delete button. I have tried like
array(
‘class’=>‘CButtonColumn’,
‘template’=>’{update}{delete}’,
‘deleteButtonUrl’=>‘Yii::app()->createUrl(“answers/delete”, array(“aid”=>$data->id,“qid”=>$data->question_id,“oid”=>$data->ordering))’,
),
But it is still not working.
mdomba
(Maurizio Domba Cerin)
7
NOTE: when you post code please use the code button <>… or type [ code] your code [ /code] (without spaces)… so that your code is more readable
Just noticed that you use Yii::app()->createUrl()… that does not exists and it fires an error… you need to use Yii::app()->controller->createUrl(…)
gnekkala
(Ngprasad20)
8
Thanks mdomba. I am new to yii. I will your instructions.
I have tried like
'deleteButtonUrl'=>'Yii::app()->controller->createUrl("answers/delete", array("aid"=>$data->id,"qid"=>$data->question_id,"oid"=>$data->ordering))',
But it is still not working. It gives error "Your request is invalid.".
mdomba
(Maurizio Domba Cerin)
9
Check your actionDelete() parameter names… they should be the same as the one you are sending here…
So it should be
public function actionDelete($aid,$qid,$oid)
If you have for example $id instead of $aid like:
public function actionDelete($id,$qid,$oid)
Then you would get the error "Your request is invalid"