Welcome Guest, Not a member yet? Register   Sign In
Setting Variable within form_validation from XXX extends form_validation
#1

[eluser]amites[/eluser]
Hello,

I am attempting to build a function to add multiple groups of config rules for a single run,

what I have here works, it sets $this->_form_data properly

Code:
class MultiValid extends CI_Form_validation {
    function multi_rules($group = '') {
        
        $this->CI->config->load('form_validation', TRUE);
        $rules = $this->CI->config->item('form_validation');
        
//        print_r($rules);

//        $rules = $this->CI->_config_rules[$group];

//        $t = $this->CI->_config_rules;
//        if (is_array($t)) print_r($t);
//            else echo 'nope';
            
        $set = false;
        if (is_array($group)) {
            foreach ($group as $grp) {
                
                if ($grp != '' && isset($rules[$grp])) {
                    
                    $this->set_rules($rules[$grp]);
                    $set = true;
                }
            }
        }
        
        return $set;
    }
}

trick is that when I reference form_validation it doesn't acknowledge the changes from this child class,

ex:

I can reference $this->multidata->_form_data
filled with values

when I reference $this->form_validation->_form_data
empty

any ideas?




Theme © iAndrew 2016 - Forum software by © MyBB