Welcome Guest, Not a member yet? Register   Sign In
My_Form_validation class not loading
#1

[eluser]ChrisHJ[/eluser]
Hi,

I'm trying to use a custom validation class with custom validation rules, but for some reason the class never loads.

The set-up is very simple, so I'm just gonna give it all to you here, starting with my function (in controller 'Bruger') when the button is clicked:

Code:
public function glemt_adgangskode()
    {
        $this->load->library('auth');
        
        $send = $this->input->post('create');
        
        if($send)
        {
            print_r($this->auth->forgot_password($this->input->post('user_email')));
        }
        
        $this->load->view('form');
    }

This should bring us to the auth library, in the function forgot_password($user_email):

Code:
public function forgot_password($user_email)
    {
        $this->ci->load->library('form_validation');
        
        $this->ci->form_validation->set_error_delimiters('<li>', '</li>');
        
        $this->ci->form_validation->set_rules('user_email', 'Email', 'required|tester_valid');
        
        if ($this->ci->form_validation->run() == FALSE)
    {
    $this->data['val'] = validation_errors();
                            
    } else {
        
            $this->data['val'] = "<li>Ny adgangskode bestilt.</li>";
    }
        
        return $this->data;
    }

I have no problem with the build-in rules ('required' works), but my custom rule 'tester_valid' does not.

My test is very simple:
Code:
class My_Form_validation extends CI_Form_validation {

    public function __construct() {
        parent::__construct();
        $ci = & get_instance();
        
        log_message('debug', 'My_Form_validation loaded');
    }
    
    public function tester_valid($var) {
/* doesn't matter, the class never loads! /*
}

The function is empty for now. Like I said, the class is never found by CI, as proved by log:

Code:
DEBUG - 2012-01-28 16:42:13 --&gt; Config Class Initialized
DEBUG - 2012-01-28 16:42:13 --&gt; Hooks Class Initialized
DEBUG - 2012-01-28 16:42:13 --&gt; Utf8 Class Initialized
DEBUG - 2012-01-28 16:42:13 --&gt; UTF-8 Support Enabled
DEBUG - 2012-01-28 16:42:13 --&gt; URI Class Initialized
DEBUG - 2012-01-28 16:42:13 --&gt; Router Class Initialized
DEBUG - 2012-01-28 16:42:13 --&gt; Output Class Initialized
DEBUG - 2012-01-28 16:42:13 --&gt; Security Class Initialized
DEBUG - 2012-01-28 16:42:13 --&gt; Input Class Initialized
DEBUG - 2012-01-28 16:42:13 --&gt; Global POST and COOKIE data sanitized
DEBUG - 2012-01-28 16:42:13 --&gt; Language Class Initialized
DEBUG - 2012-01-28 16:42:13 --&gt; Loader Class Initialized
DEBUG - 2012-01-28 16:42:13 --&gt; Helper loaded: url_helper
DEBUG - 2012-01-28 16:42:13 --&gt; Helper loaded: form_helper
DEBUG - 2012-01-28 16:42:13 --&gt; Controller Class Initialized
DEBUG - 2012-01-28 16:42:13 --&gt; Form Validation Class Initialized
DEBUG - 2012-01-28 16:42:13 --&gt; Language file loaded: language/english/form_validation_lang.php
DEBUG - 2012-01-28 16:42:13 --&gt; File loaded: /application/views/form.php
DEBUG - 2012-01-28 16:42:13 --&gt; Final output sent to browser
DEBUG - 2012-01-28 16:42:13 --&gt; Total execution time: 0.1228

Im using CI 2.1.0, and in the previous version of ci there was no problem..

The really weird part is that other classes with 'MY_' prefix loads just fine, and I can't for the world figure why this particular one doesn't.

Please help me!



Messages In This Thread
My_Form_validation class not loading - by El Forum - 01-28-2012, 09:02 AM
My_Form_validation class not loading - by El Forum - 01-28-2012, 09:07 AM
My_Form_validation class not loading - by El Forum - 01-28-2012, 09:12 AM
My_Form_validation class not loading - by El Forum - 01-28-2012, 09:19 AM
My_Form_validation class not loading - by El Forum - 01-28-2012, 09:36 AM
My_Form_validation class not loading - by El Forum - 01-28-2012, 10:03 AM
My_Form_validation class not loading - by El Forum - 01-28-2012, 11:04 PM
My_Form_validation class not loading - by El Forum - 01-29-2012, 02:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB