1
我有一個基於this教程的登錄portlet已啓動並正在運行。它工作得很好,但是,如果登錄表單出現錯誤,則錯誤消息顯示在Portlet中,並且它們不是非常突出。使用Portlet呈現/重定向到另一個視圖
該portlet如下:
class UserLogin extends Portlet
{
public $title='Login';
protected function renderContent()
{
$form=new LoginForm;
if(isset($_POST['LoginForm']))
{
$form->attributes=$_POST['LoginForm'];
if($form->validate())
$this->controller->refresh();
}
$this->render('userLogin',array('form'=>$form));
}
}
我寧願任何錯誤導致登錄嘗試重定向到可以醒目地顯示了錯誤的一個完整的登錄表單,這將是清楚明瞭的用戶出了一些錯誤。
東西線沿線的:
if($form->validate())
$this->controller->refresh();
else
$this->render('login',array('form'=>$form));
的其他位不正確的,但是,我似乎是無法弄清楚如何做到這一點。
精美的作品。我只是通過Yii :: app() - > user-> setFlash('login',$ form);來傳遞整個表單。 – 2010-08-12 18:00:11