尝试在CodeIgniter
中为min_length
和max_length
验证约束设置自定义验证消息时出现错误。验证codeigniter中的max_length,min_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');
在我的例子中,我们有两个领域,但我有不同的最小和最大长度诸多领域值。他们都有一个特定的约束验证。此消息不起作用。该消息默认显示。谢谢你的帮助。
在我的源代码中没关系。当我做我的职位时,我忘记了关闭沮丧。我的怀疑继续。感谢您的更正。 – cabita
@cabita - 我已经更新了我的答案。 – stealthyninja
谢谢,我会审查你的答案。谢谢。 – cabita