这些是我的验证规则:
'TotalAmount' => array(
'money' => array(
'rule' => array('money', 'left'),
'message' => 'Enter a valid money amount.',
'allowEmpty' => false,
'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
'notempty' => array(
'rule' => array('notempty'),
'message' => 'This field can not be empty',
//'allowEmpty' => false,
//'required' => true,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
)
)
答案 0 :(得分:0)
你最好创建自己的验证规则来处理这个问题 - 技术上钱不能消极(但我理解你需要它的理由)
点击此链接:
http://book.cakephp.org/2.0/en/models/data-validation.html#adding-your-own-validation-methods
基本上你的函数只需要返回true或false!