AP81
(Adamperks81)
August 22, 2013, 4:36am
1
Hi,
I get an exception when I try to pass multiple parameters to an action, even though the action is correctly defined.
exception ‘CHttpException’ with message ‘Your request is invalid.’
Doesn’t work
localhost/test/trip/purchase/1/1
Works
localhost/test/trip/purchase/1
The action:
public function actionPurchase($id, $partnerId = null) {
Can I configure this in the URL manager? I wasn’t able to get it to work.
Thanks
ronald58
(Yii)
August 22, 2013, 5:23pm
2
AP81:
Hi,
I get an exception when I try to pass multiple parameters to an action, even though the action is correctly defined.
exception ‘CHttpException’ with message ‘Your request is invalid.’
Doesn’t work
localhost/test/trip/purchase/1/1
Works
localhost/test/trip/purchase/1
The action:
public function actionPurchase($id, $partnerId = null) {
Can I configure this in the URL manager? I wasn’t able to get it to work.
Thanks
When you do not give the parameter name and you pass only 1 parameter the parameter name "id" is assumed, but when you pass more parameters you need to tell their names:
localhost/test/trip/purchase/id/1/partnerId/1
jayant
(Codesutras)
August 23, 2013, 9:19am
3
First of all check your URL manager settings in main.php file (just to make sure that there is no any special condition)
Then pass the parameters in your request url as Ronald_ said. So, your link is something like this.
echo chtml:link('link1',array('test/trip','id'=>1,'parentid'=>1));