【发布时间】:2011-09-28 23:33:59
【问题描述】:
我正在尝试加载自定义错误消息以在验证我的“注册”表单时使用。
用户模型:
https://github.com/ashleyconnor/Egotist/blob/master/classes/model/user.php
帐户管理员:
https://github.com/ashleyconnor/Egotist/blob/master/classes/controller/user/account.php
注册视图:
https://github.com/ashleyconnor/Egotist/blob/master/views/account/signup.php
然后我将user.php 放入/messages/models/user.php,但我的新错误消息没有显示在表单中。
<?php defined('SYSPATH') or die('No direct script access.');
return array
(
'username' => array
(
'not_empty' => 'your message',
'max_length' => 'your message',
'alpha_dash' => 'your message',
'default' => 'default message'
),
);
?>
https://github.com/ashleyconnor/Egotist/blob/master/messages/models/user.php
所以提交一个空表单会给出以下错误信息:
- 用户名不能为空
- 电子邮件地址不能为空
- 密码不能为空
哪些是默认的。
【问题讨论】:
标签: validation kohana kohana-3