Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9134513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:40:29+00:00 2026-06-17T08:40:29+00:00

I know this has been asked before, and I’ve looked through every answer posted,

  • 0

I know this has been asked before, and I’ve looked through every answer posted, but to no avail. Basically, I am trying to extend the Codeigniter form validation library on a CI2+ project, but every single time I get the error:

Fatal error: Call to a member function get_errors_array() on a non-object

Below is my code:

application/core/CB_Form_validation.php

class CB_Form_validation extends CI_Form_validation{
    function __construct($rules = array()) {
        parent::__construct($rules);
        log_message('debug', "CB_Form_validaiton class initialized");
    }

    public function get_errors_array() {
        return $this->_error_array;
    }
}

and then in my ajax file I have the construct etc.

public function save(){
    if($this->form_validation->run() == FALSE){

    }
}

and inside that if statement I have tried the following:

echo $this->form_validation->get_errors_array();
echo $this->cb_form_validation->get_errors_array();
echo get_errors_array();

I have also tried placing the CB_Form_validation.php in application/libraries as well. Just as well, I have also tried this in my construct of my ajax controller

$this->load->library('CB_Form_validation');
$this->load->library('core/CB_Form_validation');

And I have set CB_ as my custom class prefix

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:40:30+00:00Added an answer on June 17, 2026 at 8:40 am

    Turns out that to fix this, you should do the following:

    1. Move your custom form validation class to the application/libraries folder
    2. You can keep the construct of your custom class how it is
    3. Use $this->form_validation->method() to access the function you would like
    4. As long as your loading the form_validation library, you don’t need to perform $this->load->library('custom_class') because CI picks up on your custom prefix anyways

    Hope this helps someone

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this has been asked before but I have looked at every answer
I know this has been asked before , but at this time the answer
I know this has been asked before, but i can't find a good answer
I know this has been asked before, but I did not find its answer
I know this question has been asked before, but there was no clear answer.
I know this has been asked before but all the answers I found didn't
I know this has been asked before, but I just cant seem to find
Ok, I know this has been asked before but after searching I couldn't find
I know this has probably been asked before but for my problem I cannot
I know this question has been asked before, but non of the solutions solve

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.