【发布时间】:2012-01-19 04:47:24
【问题描述】:
尝试在CodeIgniter 中为min_length 和max_length 验证约束设置自定义验证消息时出现错误。
这些是我的验证规则:
$this->form_validation->set_rules('username', 'Username', 'required|xss_clean|min_length[6]|max_length[10]');
$this->form_validation->set_rules('password', 'Password', 'required|min_length[8]|max_length[20]';
这些是我的自定义验证消息:
$this->form_validation->set_message('min_length[3]', '%s: the minimum of characters is three');
$this->form_validation->set_message('max_length[20]', '%s:the maximum of characters is 20');
在我的示例中,我们有两个字段,但我有许多具有不同最小和最大长度值的字段。它们都有特定的约束验证。此消息不起作用。默认情况下会显示该消息。感谢您的帮助。
【问题讨论】:
标签: php codeigniter validation