我使用的帳戶控制器沒有自己的表,但使用用戶模型。Cakephp驗證
所有工作正常,除非 - 當我驗證任何形式。它說,驗證失敗(當我嘗試失敗的驗證檢查),但犯規扔場下面的錯誤
查看
<?php echo $this->Form->input('id'); ?>
<label for="UserPassword">New Password:</label>
<?php echo $this->Form->text('password', array('type' => 'password', 'value' => 'harsha')); ?><em>Password must be min 6 characters.</em> <?php echo $form->error('password'); ?>
控制器動作
if($this->User->saveField('password', $this->data['User']['password'], array('validate' => 'first'))) {
$this->Session->setFlash('Password has been changed.', 'flash-success');
} else {
$this->Session->setFlash('There was some problem with our system. Please try after some time.', 'flash-warning');
}