您好,我有以下型號:CakePHP的顯示標籤元素旁邊驗證錯誤的觀點
class Mymodel extends AppModel {
public $validate = array(
'username' => array(
'required' => array(
'rule' => array('notEmpty'),
'message' => 'A username is required'
),
'regexp' => array(
'rule' => '/^[a-z0-9]{3,10}$/i',
'message' => 'Only letters and integers, min 3, max. 10 characters'
)
)
)
}
及以下觀點:signup.ctp
<?php
echo $this->Form->create("Mymodel ");
echo $this->Form->input('username' ,array('label'=>"Username :"));
echo $this->Form->input('password' ,array('label'=>"Password :",'type' => 'password'));
echo $this->Form->end('signup');
?>
我的控制器:
class MymodelController extends AppController
{
public function signup()
{}
}
cakePHP的默認驗證行爲是顯示輸入下面的錯誤消息,所以我的問題是:我該如何笑W的標籤字段錯誤,我的意思是這樣的:
用戶名:(我要在這裏展示的錯誤消息)