这个表单的错误怎么显示 [ 新手入门 ]
这个是控制层的
<?php
public function actionIndex()
	{
		// renders the view file 'protected/views/site/index.php'
		// using the default layout 'protected/views/layouts/main.php'
        $model=new LoginForm;
        $regModel=new RegForm;
		$this->render('index', array('model' => $model,'regModel' => $regModel));
	}
/**
	 * Displays the login page
	 */
	public function actionLogin()
	{
		$model=new LoginForm;
		// if it is ajax validation request
		if(isset($_POST['ajax']) && $_POST['ajax']==='login-form')
		{
			echo CActiveForm::validate($model);
			Yii::app()->end();
		}
		// collect user input data
		if(isset($_POST['LoginForm']))
		{
			$model->attributes=$_POST['LoginForm'];
			// validate user input and redirect to the previous page if valid
			if($model->validate() && $model->login())
            {
				$this->redirect(Yii::app()->user->returnUrl);
            } else {
                var_dump($model);
                //$this->redirect(array('/site/index'));
            }
		}
		// display the login form
		//$this->render('login',array('model'=>$model));
	}
?>
http://127.0.0.1/index.php?r=site/index  页面显示 点击登录以后执行site/login方法.出错返回到site/index页面,但是页面不会显示出错信息,要怎么才能把这个错误信息带上?
<?php
//登录表单开始
$form = $this->beginWidget('bootstrap.widgets.BootActiveForm', array(
    'id' => 'LoginForm',
    'htmlOptions' => array('class' => 'well'),
    'action' => array('/site/login'),
    'method' => 'post',
));
echo $form->textFieldRow($model, 'username', array('class' => 'span3'));
echo $form->passwordFieldRow($model, 'password', array('class' => 'span3') );
echo $form->textFieldRow($model, 'verifyCode',array('class' => 'span3'));
$this->widget('CCaptcha', array(
    'buttonLabel' => '看不清楚,换一张',
    'imageOptions' => array(
        'id' => 'LoginCode',
    )
));
echo $form->checkboxRow($model, 'rememberMe');
$this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'submit', 'icon'=>'ok', 'label'=>'登录'));
$this->endwidget();
?>
共 0 条回复
没有找到数据。
南龙
            注册时间:2012-01-05
最后登录:1970-01-01
在线时长:0小时0分
    最后登录:1970-01-01
在线时长:0小时0分
- 粉丝0
 - 金钱135
 - 威望0
 - 积分135