arbir
(Arvind Rangan)
October 7, 2009, 4:15am
1
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
pestaa
(Pestaa)
October 7, 2009, 6:30am
2
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.
arbir
(Arvind Rangan)
October 7, 2009, 4:24pm
3
How do I do this ? And when you say Link, do you mean, the anchor element ?
thanks
Arvind
pestaa
(Pestaa)
October 7, 2009, 7:42pm
4
Yes, as simple as an anchor item.
arbir
(Arvind Rangan)
October 7, 2009, 7:59pm
5
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.
pestaa
(Pestaa)
October 8, 2009, 8:49pm
6
Try
<?php echo CHtml::Button('Cancel',array('submit'=>array('cancel')));?>
arbir
(Arvind Rangan)
October 9, 2009, 3:24am
7
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