0

所以我有 Yii-user 和 Yii-bootstrap。当用户单击主页上的某些内容时,我想使用模式对话框加载注册表单。我已在所有控制器的操作中加载了该类。

 $this->beginWidget('bootstrap.widgets.BootModal', array('id'=>'logonDialog')); ?>
   <div class="modal-header">
    <a class="close" data-dismiss="modal">&times;</a>
    <h3>Inscription ou Connexion</h3></div>
    <div class="modal-body">
      <div class="row">
         <div class="span6"><?php
          $lmodel=new UserLogin;
          $this->renderPartial('application.modules.user.views.user.login',array('model'=>$lmodel,));
         ?></div>
         <div class="span6">
         <?
          $rmodel = new RegistrationForm;
          $rprofile=new Profile;
          $this->renderPartial('application.modules.user.views.user.registration',array('model'=>$rmodel,'profile'=>$rprofile));
         ?>
         </div>
      </div>
  </div>
 <div class="modal-footer"></div>
<?php $this->endWidget();

登录表单工作正常,但唯一的问题是注册表单上没有验证码,并且我在日志中收到错误消息:

2012/07/14 12:37:28 [warning] [application] Failed to set unsafe attribute "verifyCode" of "RegistrationForm".
in /home/something/protected/modules/user/controllers/RegistrationController.php (29)
in /home/something/public_html/test.php (15)
2012/07/14 12:37:32 [warning] [application] Failed to set unsafe attribute "verifyCode" of "RegistrationForm".
in /home/something/protected/modules/user/controllers/RegistrationController.php (29)
in /home/something/public_html/test.php (15)
2012/07/14 12:37:38 [warning] [application] Failed to set unsafe attribute "verifyCode" of "RegistrationForm".
in /home/something/protected/modules/user/controllers/RegistrationController.php (29)
in /home/something/public_html/test.php (15)
2012/07/14 12:37:41 [warning] [application] Failed to set unsafe attribute "verifyCode" of "RegistrationForm".
in /home/something/protected/modules/user/controllers/RegistrationController.php (29)
in /home/something/public_html/test.php (15)
2012/07/14 12:37:42 [warning] [application] Failed to set unsafe attribute "verifyCode" of "RegistrationForm".
in /home/something/protected/modules/user/controllers/RegistrationController.php (29)
in /home/something/public_html/test.php (15)
2012/07/14 12:37:48 [warning] [application] Failed to set unsafe attribute "verifyCode" of "RegistrationForm".
in /home/something/protected/modules/user/controllers/RegistrationController.php (29)
in /home/something/public_html/test.php (15)
2012/07/14 12:38:01 [warning] [application] Failed to set unsafe attribute "verifyCode" of "RegistrationForm".
in /home/something/protected/modules/user/controllers/RegistrationController.php (29)
in /home/something/public_html/test.php (15)
2012/07/14 12:38:04 [warning] [application] Failed to set unsafe attribute "verifyCode" of "RegistrationForm".
in /home/something/protected/modules/user/controllers/RegistrationController.php (29)
in /home/something/public_html/test.php (15)
2012/07/14 12:38:13 [warning] [application] Failed to set unsafe attribute "verifyCode" of "RegistrationForm".
in /home/something/protected/modules/user/controllers/RegistrationController.php (29)
in /home/something/public_html/test.php (15)
2012/07/14 12:38:14 [warning] [application] Failed to set unsafe attribute "verifyCode" of "RegistrationForm".
in /home/something/protected/modules/user/controllers/RegistrationController.php (29)
in /home/something/public_html/test.php (15)
2012/07/14 12:38:14 [warning] [application] Failed to set unsafe attribute "verifyCode" of "RegistrationForm".
in /home/something/protected/modules/user/controllers/RegistrationController.php (37)
in /home/something/public_html/test.php (15)
2012/07/14 12:44:56 [error] [exception.CHttpException.404] exception 'CHttpException' with message 'Le système ne peut trouver l'action « captcha » demandée.' in /home/something/yii/framework/web/CController.php:484
Stack trace:
#0 /home/something/yii/framework/web/CController.php(271): CController->missingAction('captcha')
#1 /home/something/yii/framework/web/CWebApplication.php(276): CController->run('captcha')
#2 /home/something/yii/framework/web/CWebApplication.php(135): CWebApplication->runController('user/login/capt...')
#3 /home/something/yii/framework/base/CApplication.php(162): CWebAp
4

1 回答 1

0

您需要为同一模型上的多个表单使用不同的场景。阅读yii 场景

您还需要了解安全验证规则

于 2012-07-15T07:10:32.347 回答