form->validate, where?

The above code is taken from the site controller right after setting up a project with yiic webapp. I have highlighted the line: if($form->validate())

This calls a validate function on a LoginForm model. Where is this function? I can’t find it in any of the files.

Have you checked CModel?

APIs will definitely help you in such cases. I suggest you to familiarize yourself with the current source documentation as it also tells you where certain methods are defined.

Ah, oops :unsure:

So… validate() calls

public function rules()


		return array(

			// username and password are required

			array('username, password', 'required'),

			// password needs to be authenticated

			array('password', 'authenticate'),



which is in the LoginForm model. Thanks!