So I have a code here to val开发者_运维知识库idate the usernname exist or not, I'm using tank_auth library
if(! $this->tank_auth->is_username_available($username))
{
$this->form_validation->set_message('username_check');
}
In the form validation file ( validation.php ) how can I call this message
'register_view' => array(
array(
'field' => 'username',
'label' => 'أسم المستخدم',
'rules' => 'required|trim|max_length[20]|username_check'
),
I added username_check at the end isn't this right?
well it's easier to use
'rules' => 'required|trim|max_length[20]|is_unique[users.username]'
Form validation
and add your custom message here
$this->form_validation->set_message('is_unique', 'Error Message');
I can see you are using Arabic it's better to check how to integrate language with default form validation messages as well
精彩评论