URL problem while calling controller from Chtml::button

Hello,

I have a form where i am updating. its url looks like this

http://localhost/blog/index.php/user/update/id/2

i have defined a cancel button in that form,

<?php echo CHtml::Button(‘Cancel’,array(‘submit’=>‘cancel’));?>

when i hit cancel, it keeps going to this url.

http://localhost/blog/index.php/user/update/id/cancel

where as it should goto

http://localhost/blog/index.php/user/cancel

I do not want to hard code. how can i do this ?

Arvind

Initiate a GET request with a single link. From a designer’s perspective, it’s even more acceptable to create links instead of buttons when there are no changes on server-side.

How do I do this ? And when you say Link, do you mean, the anchor element ?

thanks

Arvind

Yes, as simple as an anchor item.

I do not want to use a link.

I want a proper html button with the ability to cancel the current form and move back to the previous controller function.

Try


<?php echo CHtml::Button('Cancel',array('submit'=>array('cancel')));?>

Superb. It works like magic.

Now can you pleaes explain, what is the principle of putting an array inside an array ? How does the yii framework parse it ?

thanks

Arvind