Welcome Guest, Not a member yet? Register   Sign In
trigger form_error without going through the form_validation->run()
#1

[eluser]Dennis_gull[/eluser]
Is it possible to trigger the the form_error without using $this->form_validation->run()?

For example if a user is signing in I want the regular validation to run then after the validation I want to check the database to see if the information match anyone, if it does I need to take this information and save it in the session, example:

Code:
if( $this->form_validation->run('login_user') )
{
    $result = $this->db->select('id, username, language')->from('users')->where($where)->get()->row();
    if(count($result) == 1)
    {
        // continue with login using the $result variable
    }
    else
    {
        // trigger form error
    }
}

For this example I can't use a custom_validation because I need the user information after the validation and I don't want to run the query twice.


Messages In This Thread
trigger form_error without going through the form_validation->run() - by El Forum - 02-09-2010, 09:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB