Welcome Guest, Not a member yet? Register   Sign In
I want to return object from a function within a module to callback function
#2

[eluser]LuckyFella73[/eluser]
Hi Buratino,

for the form validation callback function is just meant to know wether
the result is TRUE or FALSE I can't see a reason you want to return
an object from your model. Your controller function "can_log_in()"
should just return TRUE or FALSE.

Just a hint: prefix your controller function "can_log_in" with an
underscore to make it private and add one undersore where
you set the callback function as a rule. Otherwise that method can
be called directly:

Code:
$this->form_validation->set_rules('login','Login','required|xss_clean|unique|trim|callback__can_log_in');
$this->form_validation->set_rules('password','Password','required|trim');

function _can_log_in()
{
$this->load->model('site_model');
return $this->site_model->can_log_in($this->input->post('login',true),$this->input->post('password',true));
}


Messages In This Thread
I want to return object from a function within a module to callback function - by El Forum - 02-21-2013, 03:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB