CodeIgniter Forums
Problem loading Validation Class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Problem loading Validation Class (/showthread.php?tid=4078)



Problem loading Validation Class - El Forum - 11-05-2007

[eluser]Unknown[/eluser]
Hello, I am having issues loading codeigniters validation class. I first tried using the library inside of one of my own controllers and had no success so I tried to use the example in the user's guide and still have no luck. I then tried to autoload the class but that did not work. As a last resort, I tried to restart my HTTP server thinking the pages were not updating and it still fails. I am using PHP 5 + Apache 2.2. Below is an example along with the error that I am receiving. Thank you all in advance

/* User Guide Example */

class Form extends Controller {

function index()
{
$this->load->helper(array('form', 'url'));

$this->load->library('validation');

$rules['username'] = "required";
$rules['password'] = "required";
$rules['passconf'] = "required";
$rules['email'] = "required";

$this->validation->set_rules($rules);

if ($this->validation->run() == FALSE)
{
$this->load->view('myform');
}
else
{
$this->load->view('formsuccess');
}
}
}

/* End user guide example */

/* error message when loading the view. Error is from the form.php class so the view is not even loading yet because of errors* /


Severity: Notice

Message: Undefined property: Form::$validation

Filename: controllers/form.php

Line Number: 16

Call to a member function set_rules() on a non-object in form.php


Problem loading Validation Class - El Forum - 11-06-2007

[eluser]Unknown[/eluser]
Nevermind, I just read that only php 4 is supported that explains why this is not working. Thank you.