How to define the submitButton action?

Hi all,

For those who still haven’t read my topics, I’m new to Yii.

I’ve just installed the sample application that comes with Yii and found that the views’ submit buttons execute the corresponding form actions, like in the following code extracted from the page source of the contact view:

<form id="contact-form" action="/testdrive/index.php?r=site/contact" method="post">

The problem that I’m facing at the moment is that I cannot find where this action is defined. I’ve checked the controller and model files and found nothing what so ever.

I need to know that so that I can create my own forms and declare what buttons should do when pressed.

Thanks in advance to those developers who can explain to me where to defined a button/form action.


You should start with The Definitive Guide to Yii. Then you will know the answer to this and other questions.


Excellent guide. Thanks very much.