how to assign an action to CHtml::Button() ?

Here is the button() spec from class reference of CHtml:

http://www.yiiframework.com/doc/api/1.1/CHtml#button-detail

public static string button(string $label=‘button’, array $htmlOptions=array ( ))

But from this spec, I couldn’t know how to trigger an action using this. How do I assign an action in the form of controller/action format, or in the url format(e.g. www.yahoo.com)

Can you help? where I can find an example of CHtml::Buttion()? Is this the right question to ask? I think I got lost…

I think action to be assigned to form, not button

What do you mean? I don’t understand…

You can assign action to <form> tag

I see… Thanks!

Try this:




<?php echo CHtml::Button('Go to Yahoo!', array('submit' => 'http://www.yahoo.com')); ?>



yeah, it’s what I need! thanks!

Very nice!

Please don’t forget to vote ;)

How do I vote? Rate Topic on top right corner?

Go to post number 6 and click the green plus button there. ;)

That way you reward him for providing you with a good answer - and encourage him to keep on helping out.

That’s the main idea anyway.

I see…Thanks for letting me know!

Thanks, jacmoe!

+1 for you ;)