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

[eluser]smick[/eluser]
Greetings,

I'm experiencing a PHP error when using CI's validation class. Unable to track the error down, I did a fresh install of CI (version: 1.6.3) and used minimal code to test validation yet still I receive error. The error is question is:

Quote:Severity: Notice

Message: Undefined property: CI_Validation::$username

My test code was swiped from the documentation and is as follows:

Controller:
Code:
<?php

class Test_validation 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('test_validation');
        }
        else
        {
            $this->load->view('test_validation');
        }
    }
}
?>

View:
Code:
<html>
<head>
<title>My Form</title>
</head>
<body>

<?php echo $this->validation->error_string; ?>

<?php echo form_open('test_validation'); ?>

<h5>Username</h5>
&lt;input type="text" name="username" value="&lt;?php echo $this-&gt;validation->username;?&gt;" size="50" />

<h5>Password</h5>
&lt;input type="text" name="password" value="&lt;?php echo $this-&gt;validation->password;?&gt;" size="50" />

<h5>Password Confirm</h5>
&lt;input type="text" name="passconf" value="&lt;?php echo $this-&gt;validation->passconf;?&gt;" size="50" />

<h5>Email Address</h5>
&lt;input type="text" name="email" value="&lt;?php echo $this-&gt;validation->email;?&gt;" size="50" />

<div>&lt;input type="submit" value="Submit" /&gt;&lt;/div>

&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;

I have successfully used CI's validation class in the past. Might my host have changed something on me?

Also, I'm working on a super clean and super easy to implement user auth model which I hope to share with the community when complete. What would be the proper channel through which to submit this?

Thanks for the help,

Nathan


Messages In This Thread
validation not working - by El Forum - 10-24-2008, 04:06 PM
validation not working - by El Forum - 10-24-2008, 04:57 PM
validation not working - by El Forum - 10-24-2008, 08:30 PM
validation not working - by El Forum - 10-24-2008, 08:40 PM
validation not working - by El Forum - 10-24-2008, 08:45 PM
validation not working - by El Forum - 10-24-2008, 08:52 PM
validation not working - by El Forum - 10-25-2008, 03:59 AM
validation not working - by El Forum - 10-25-2008, 11:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB