Welcome Guest, Not a member yet? Register   Sign In
Form validation callbacks not working
#1

Hello,

After upgrade fromĀ 2.2.6 to 3.1.9. I noticed my callback function for form validation not working.

PHP Code:
function update_password()
    {
        
        if(
$this->session->userdata('recovery')!='yes')
        
$this->form_validation->set_rules('current_password''Current Password''callback_currentpass_check');
        
        
$this->form_validation->set_rules('new_password''New Password''required|matches[re_password]');
        
$this->form_validation->set_rules('re_password''Password Confirmation''required');
            
        if (
$this->form_validation->run() == FALSE)
        {
            
$this->changepass();    
        }
        else
        {
            
                
$password $this->input->post('new_password');
                
$this->auth_model->update_password($password);
                
$this->session->set_userdata('recovery',"no");
                
$this->session->set_flashdata('msg''<div class="alert alert-success">Password changed successfully</div>');                
            
            
redirect(site_url('admin/auth/changepass'));        
        }
    
    } 



PHP Code:
public function currentpass_check($str)
    {
        
$user_name 'test_user';
        
$res $this->auth_model->check_login($user_name,$str);
        
        if (
$res == 0)
        {
            
$this->form_validation->set_message('currentpass_check''Current password Didn\'t match');
            return 
FALSE;
        }
        else
        {
            return 
TRUE;
            
        }
    } 

I am getting this error.
[Image: 50575236-2500a200-0e03-11e9-97ae-d19325f4aa60.png]
My callback function ( currentpass_check) returns TRUE.
Reply


Messages In This Thread
Form validation callbacks not working - by Codehoster - 01-02-2019, 01:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB