Form question

I saw the following code in the tutorials and want to ask a few questions about it:


public function actionLogin()

{

    $model = new LoginForm;

    $form = new CForm('application.views.site.loginForm', $model);

    if($form->submitted('login') && $form->validate())

        $this->redirect(array('site/index'));

    else

        $this->render('login', array('form'=>$form));

}

1, What does the string ‘login’ refer to in the following: $form->submitted(‘login’)

2, Why is that line of code required? Why not just $form->submitted() ?

3, What does the second parameter hold in the render function? Is it needed?

Many thanks.




public function submitted($buttonName='submit',$loadData=true)

{

    $ret=$this->clicked($this->getUniqueId()) && $this->clicked($buttonName);

    if($ret && $loadData)

        $this->loadData();

    return $ret;

}



Method submitted() checks if form is submitted and assigns request data to model. Method validate() validates the models associated with this form.




$this->render('login', array('form'=>$form));



Second parameter - data to be extracted into PHP variables and made available to the view script