Welcome Guest, Not a member yet? Register   Sign In
Loading helpers/librarys in _construct
#6

[eluser]Braden Schaeffer[/eluser]
[quote author="brianw1975" date="1251156901"]I'll admit that I haven't used the form_validation helper yet, but part of me is thinking (unless you just bodged together some sample code) that a problem may be popping up because of incorrectly supplied data (namely your rules) to set_rules().[/quote]

I just created an example page to reproduce the problem. I'll admit I had much more code than I posted previously, but here is exactly what the markup for the example controller looks like, and it reproduces the same error message:

Code:
class Example extends Controller {
    
    function _construct()
    {
        parent::Controller();
        $this->load->helper('form');
        $this->load->library('form_validation');
    }
    
    function index()
    {
        $this->form_validation->set_rules('name', 'name', 'max_length[100]|xss_clean');
        
        if($this->form_validation->run() == FALSE)
        {
            $data['content'][0] = "Bad Submission";
        }
        else
        {
            $data['content'][0] = "Congratulations";
        }
        
        $data['content'][1] = $this->load->view('some/form', '', TRUE);
        
        $this->load->view('standard/header');
        $this->load->view('standard/content', $data);
        $this->load->view('standard/footer');
    }
    
}

A few things...

(1) I know that I am passing a valid rule string because it works if I load the helper and library in the index function.

(2) The view 'some/form' doesn't even exist, but the script dies before it even realizes this. I have also tried it with a simple form in a view that does exist, but it doesn't seem to matter.

I really appreciate all you're replies. Whether we find an answer or not, you guys are awesome. Thanks!


Messages In This Thread
Loading helpers/librarys in _construct - by El Forum - 08-24-2009, 10:45 AM
Loading helpers/librarys in _construct - by El Forum - 08-24-2009, 10:49 AM
Loading helpers/librarys in _construct - by El Forum - 08-24-2009, 12:01 PM
Loading helpers/librarys in _construct - by El Forum - 08-24-2009, 12:12 PM
Loading helpers/librarys in _construct - by El Forum - 08-24-2009, 12:35 PM
Loading helpers/librarys in _construct - by El Forum - 08-24-2009, 12:49 PM
Loading helpers/librarys in _construct - by El Forum - 08-24-2009, 01:27 PM
Loading helpers/librarys in _construct - by El Forum - 08-24-2009, 01:54 PM
Loading helpers/librarys in _construct - by El Forum - 08-24-2009, 02:10 PM
Loading helpers/librarys in _construct - by El Forum - 08-24-2009, 02:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB