开发者

Codeigntier validation issue while using tank_auth

开发者 https://www.devze.com 2023-03-23 10:27 出处:网络
So I have a code here to val开发者_运维知识库idate the usernname exist or not, I\'m using tank_auth library

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

0

精彩评论

暂无评论...
验证码 换一张
取 消