Welcome Guest, Not a member yet? Register   Sign In
form validation error return [SOLVED]
#1

[eluser]PV-Patrick[/eluser]
Hello,
I have been searching around here for hours trying to figure this problem out and I can't seem to fix it. In a nutshell, when I click submit to validate my form and it doesn't pass, I don't see the error's at all on the view.

Code:
<?php

class Products extends Controller {

    function Products() {
    
        parent::Controller();
        
        $this->load->database();
        $this->load->helper(array('form','url'));
        $this->load->library('validation');
    }
    
    function index() {
        $data['title'] = "Title";
        
        $this->load->view('products', $data);
    }
    
    function order() {
        $data['title'] = "Title";
        
        $this->load->view('order', $data);
    }
    
    function product_order() {
        $rules['firstname'] = "required|trim|min_length[2]|max_length[25]|alpha_dash";
        $rules['lastname'] = "required|trim|min_length[2]|max_length[25]|alpha_dash";
        
        $this->validation->set_rules($rules);
        
        $fields['firstname']    = 'First Name';
        $fields['lastname']        = 'Last Name';
        
        $this->validation->set_fields($fields);
        
        if($this->validation->run() == FALSE) {

            
            $this->load->view('order');
            
        } else {
            $this->load->view('formsuccess');
        }
    }

}
?>

This is a stripped version of the view page.

Code:
<?=$this->validation->error_string; ?>

<?=form_open('products/product_order', $form_attributes);?>

<table>
    <tr>
        <td><u>Billing Information</u></td>
    </tr>
    <tr>
        <td>First Name:</td>
        <td>&lt;input type="text" name="firstname" size="20" maxlength="25" onClick="loadData(&lt;?=$user_form_data?&gt;)"&gt;</td>
        <td>Last Name:</td>
        <td>&lt;input type="text" name="lastname" size="20" maxlength="25"&gt;</td>
    </tr>
    <tr>
        <td>&lt;?=form_submit('submit_order', 'Submit');?&gt;</td>
    </tr>
</table>
&lt;/form&gt;

Any help would be appreciated, thanks!


Messages In This Thread
form validation error return [SOLVED] - by El Forum - 12-03-2007, 07:18 PM
form validation error return [SOLVED] - by El Forum - 12-04-2007, 12:22 AM
form validation error return [SOLVED] - by El Forum - 12-04-2007, 12:28 AM
form validation error return [SOLVED] - by El Forum - 12-05-2007, 08:11 AM
form validation error return [SOLVED] - by El Forum - 12-05-2007, 01:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB