Welcome Guest, Not a member yet? Register   Sign In
Question about callback function
#1

[eluser]adaxa[/eluser]
Is it possible to use function located in helper file as callback function for form_validation ?
#2

[eluser]adaxa[/eluser]
Well, this is what it did.
I have extended CI_Form_validation class and added my callback function.
Is it possible to invoke existing model on that callback function ?
#3

[eluser]adaxa[/eluser]
I found a solution to the problem thanks to the guys from #codeigniter
Code:
class MY_Form_validation extends CI_Form_validation
{                              
    private $ci;
    function MY_Form_validation()
    {
        parent::CI_Form_validation();
        $this->ci =& get_instance();

    }
    function check_email($str)
    {
        if($this->ci->Mstore->get_email($str))
        {
            $this->set_message('check_email', 'Exists !');
            return FALSE;
        }
        else
        {
            return TRUE;
        }
    }
}




Theme © iAndrew 2016 - Forum software by © MyBB