Anindya Dhruba
Anindya Dhruba

Reputation: 500

Codeigniter callback function not working

I am facing this problem from yesterday and can not fix it. My callback function is not working. It's always returning TRUE, but i don't know why? Can anyone help me?

Here is the the model:

class Login_model extends CI_Model {
public function check_login($str)
    {
        $this->form_validation->set_message('check_login', 'Error');
        return FALSE;

    }
function validate_login()
{
    $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email|xss_clean');
    $this->form_validation->set_rules('password', 'Password', 'callback_check_login');

    if($this->form_validation->run() == FALSE)
    {
        return FALSE;
    }

    return TRUE;
}}

The callback function should never return TRUE. But it's returning! I am going to die with this problem! :@

Upvotes: 3

Views: 2543

Answers (1)

mrsrinivas
mrsrinivas

Reputation: 35404

It will return TRUE because

  1. You are not passing email and password to 'validate_login()'.
  2. So $this->form_validation->run() will not work.

move validate_login() to any controller

Upvotes: 4

Related Questions