Welcome Guest, Not a member yet? Register   Sign In
Using Validation Class to validate Username and Password
#2

[eluser]Mark Skilbeck[/eluser]
You want to check out callbacks.

Code:
$this->form_validation->set_rules('username', 'Username', 'trim|required|max_length[50]|xss_clean|callback_username_exists');
$this->form_validation->set_rules('password', 'Password', 'trim|required|max_length[50]');

/** your callback **/
public function username_exists ( )
{
    if ( ! $check_for_username )
    {
        $this->form_validation->set_message('username_exists', 'Username does not exist');
        return false;
    }
    else
    {
        return true;
    }
}


Messages In This Thread
Using Validation Class to validate Username and Password - by El Forum - 02-18-2009, 03:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB