Welcome Guest, Not a member yet? Register   Sign In
Validation errors
#1

[eluser]Perkin5[/eluser]
I'm having trouble with form validation errors. I have a controller called blogin that loads blogin_view containing a login form.

The blogin index method loads blogin_view but there is another function called log_in to which the form action is directed. That contains form validation rules but when I click the login button with blank inputs, the view is simply reloaded with no validation errors showing.

Controller code is like this:

Code:
function log_in()
    {
        $this->form_validation->set_rules('username','Username','required');
        $this->form_validation->set_rules('password','Password','required');
        if($this->form_validation->run() == false)
            {
                //echo validation_errors();die();
                $this->load->view('blogin_view');
                
            }

View code is like this:

Code:
<?php echo form_open('blogin/log_in','');
        echo form_fieldset('Log-in to Blog Admin');
        echo form_label('Username','username');
        echo form_error('username');
        echo form_input('username','','id="username"');
        echo form_label('Password','password');
        echo form_input('password','','id="password"');
        echo form_submit('login','Login');
        echo form_close(); ?>
        &lt;?php echo validation_errors('<p class="error">'); ?&gt;

In the log_in method is a commented out line I used for testing. When it is uncommented, the validation errors do print so they are being created. They just don't print on the view. I'm thinking that maybe I'm losing the POST array on reloading the page but I can't see why that should be.

Can anyone suggest a fix?


Messages In This Thread
Validation errors - by El Forum - 07-07-2011, 08:49 AM
Validation errors - by El Forum - 07-07-2011, 12:20 PM
Validation errors - by El Forum - 07-07-2011, 01:17 PM
Validation errors - by El Forum - 07-07-2011, 01:20 PM
Validation errors - by El Forum - 07-07-2011, 05:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB