Parameter Passing On Submit

Okay. I had a problem again with my application.

On my CGridView, I have to submit two parameters, but how can I do this?




array(

	'header'=>'Some Header',

	'type'=>'raw',

	'htmlOptions'=>array('class'=>'button-column'),

        'value'=>'CHtml::imageButton(Yii::app()->request->baseUrl . "/images/image.png",

		array(

		"submit"=>array("path/destination", "id"=>$data->id),

		))',

      ),




Now on my controller,




public function destination($id, $cat1)

	{


		$result= MyModel::model()->findByPk($id);

		$result->is_selected=true;

		$result->save();


		$model=new MyModel('search');

		$model->unsetAttributes();  // clear any default values

		if(isset($_GET['MyModel'])){

			$model->attributes=$_GET['MyModel'];

		

		}

			

		$this->render('some_path',array(

			'model'=>$model,

			'cat'=>$cat,

		));

	}



It asks for two parameters but I am only passing ‘“id”=>$data->id’. I tried to add “cat”=>{$cat} on submit but it produces an error. Something like this “submit”=>array(“path/destination”, “id”=>$data->id,“cat”=>{$cat} )

Please help me. Thank you.

The button you try to produce is a submit button for a form. That means it needs a form to submit. I suggest you use the CHtml::button function to produce a simple button and use javascript to send user to the destination:





array(

        'header'=>'Some Header',

        'type'=>'raw',

        'htmlOptions'=>array('class'=>'button-column'),

        'value'=>'CHtml::button("text on button",

                array(

                "onclick"=>"document.location.href=\'".Yii::app()->createUrl('path/destination', array('id'=>$data->id))."\'",

                ))',

      ),