Delete Using Post Request

In the controller for activeDelete I am checking if it is a post request and then only I perform delete operation so activeDelete function is something like this


public function actionDelete($groupID, $memberID)

{

          if(Yii::app()->request->isPostRequest)

          { try

			{

				

				$this->loadModel($groupID, $memberID)->delete();

			}

			catch(Exception $e) 

			{

				$this->showError($e);

			}

and in view I having a button which performs delete operation which is something like this


array('label'=>'Delete User From Group', 'icon'=>'trash', 'url'=>'#',

		'htmlOptions'=>array('submit'=>array('groupassign/delete/', array('groupID'=>$groupassign->groupID, 'memberID'=>$groupassign->memberID))

			,'class' => 'delete','confirm'=>'This will remove the image. Are you sure?'),//'url'=>Yii::app()->createUrl('groupassign/delete/', array('groupID'=>$groupassign->groupID, 'memberID'=>$groupassign->memberID)),

	),

but when I press the button to perform delete operation I get "Error 400 Your request is invalid." which I think means it is not post request but I am using post method to perform delete operation. Where I am making mistake?

I don’t think ‘submit’ takes an array, so the parameters aren’t going through.

Try




    'submit'=>Yii::app()->createUrl('groupassign/delete', array(

        'groupID'=>$groupassign->groupID,

        'memberID'=>$groupassign->memberID

    )),



Thanks Keith you are right. It’s working now.