Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Form validation always returning FALSE
#1

[eluser]kaisama[/eluser]
Alright. I've been searching the forums and Google for a few days now, trying to figure out why the form validation is not working for my application, and I've come out empty handed. So I'm turning to you guys now for help. I'm on the verge of throwing my laptop out the window over this 8D So any help is appreciated.

I don't know why, but when I try to use the form_validation library on any form, it always returns FALSE and does not return any of the validation errors, regardless of the rules that I've placed for my fields. I've even tried this on the user_guide's form validation example code and received the same results.

I have the form_validation library auto-loaded, along with with the url and form helpers.

Here's my code, and a URL to the simple form based on the user_guide example:

URL: http://www.codeigniter.deadeyes-star.com/welcome/form

Controller:
Code:
<?php

class Welcome extends Controller
{
    function __construct()
    {
        parent::__construct();
    }

    function index()
    {
        $this->template->build('welcome_message', $data);
    }
    
    function form()
        {
            $this->form_validation->set_rules('username', 'Username', 'required');
            $this->form_validation->set_rules('password', 'Password', 'required');
            $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
            $this->form_validation->set_rules('email', 'Email', 'required');
                    
            if ($this->form_validation->run() == FALSE)
                {
                    $this->load->view('myform');
                }
            else
                {
                    $this->load->view('formsuccess');
                }
        }
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */


View - myform.php:
Code:
<html>
<head>
<title>My Form</title>
</head>
<body>

<h1>Form Validation Test</h1>

&lt;?php echo validation_errors(); ?&gt;

&lt;?php echo form_open('welcome/form'); ?&gt;


<h5>Username</h5>
&lt;input type="text" name="username" value="&lt;?php echo set_value('username'); ?&gt;" size="50" /&gt;

<h5>Password</h5>
&lt;input type="text" name="password" value="&lt;?php echo set_value('password'); ?&gt;" size="50" /&gt;

<h5>Password Confirm</h5>
&lt;input type="text" name="passconf" value="&lt;?php echo set_value('passconf'); ?&gt;" size="50" /&gt;

<h5>Email Address</h5>
&lt;input type="text" name="email" value="&lt;?php echo set_value('email'); ?&gt;" size="50" /&gt;

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

&lt;/form&gt;

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

Again, any help is appreciated. Thanks in advance.


Messages In This Thread
[SOLVED] Form validation always returning FALSE - by El Forum - 08-23-2010, 07:45 PM
[SOLVED] Form validation always returning FALSE - by El Forum - 08-24-2010, 12:56 AM
[SOLVED] Form validation always returning FALSE - by El Forum - 08-24-2010, 01:01 AM
[SOLVED] Form validation always returning FALSE - by El Forum - 08-24-2010, 06:26 AM
[SOLVED] Form validation always returning FALSE - by El Forum - 08-24-2010, 07:22 AM
[SOLVED] Form validation always returning FALSE - by El Forum - 08-24-2010, 08:28 AM
[SOLVED] Form validation always returning FALSE - by El Forum - 08-24-2010, 08:43 AM
[SOLVED] Form validation always returning FALSE - by El Forum - 08-24-2010, 10:36 AM
[SOLVED] Form validation always returning FALSE - by El Forum - 08-24-2010, 01:53 PM
[SOLVED] Form validation always returning FALSE - by El Forum - 08-24-2010, 02:06 PM
[SOLVED] Form validation always returning FALSE - by El Forum - 08-24-2010, 03:24 PM
[SOLVED] Form validation always returning FALSE - by El Forum - 08-24-2010, 03:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB