07-13-2008, 11:58 AM
[eluser]jt`[/eluser]
I'm currently following this tutorial on validation using CI's built-in validation class:
http://ellislab.com/codeigniter/user-gui...ation.html
That example assumes you only have one page for input. What if I want to spread it out over 3 pages?
Currently, I'm storing all POST variables inside of session variables, in order to remember user input as they fill out forms across 3 pages. I can explain the reasoning if necessary, but ultimately I'll want to WRITE to the database after the 3rd and final form page is submitted.
Each page should go through server-side validation, and I currently am doing that on form page 1, but when I try and follow the above tutorial for form page 2, I run into two problems:
1) My URL isn't updating, it's just showing www.fu.bar/register_step1 (when in reality, once the first form is fully validated, it should load the view AND the url www.fu.bar/register_step2)
2) I'm getting errors on form page 2 for fields, they look like this:
Undefined property: CI_Validation::$textLocationName_error
Message: Undefined property: CI_Validation::$textStreet_error
Message: Undefined property: CI_Validation::$textCity
Message: Undefined property: CI_Validation::$textCity_error
For #2: I'm trying to basically pre-populate the fields if the page reloads and not every field is validated. I'm showing errors right next to each element using this syntax:
<?php echo $this->validation->textLocationName_error; ?>
===
Could anyone chime in and help me do this form validation across multiple pages? I'm following the steps in CI's Form Validation almost verbatim, so that's what most of my code looks like.
I'm currently following this tutorial on validation using CI's built-in validation class:
http://ellislab.com/codeigniter/user-gui...ation.html
That example assumes you only have one page for input. What if I want to spread it out over 3 pages?
Currently, I'm storing all POST variables inside of session variables, in order to remember user input as they fill out forms across 3 pages. I can explain the reasoning if necessary, but ultimately I'll want to WRITE to the database after the 3rd and final form page is submitted.
Each page should go through server-side validation, and I currently am doing that on form page 1, but when I try and follow the above tutorial for form page 2, I run into two problems:
1) My URL isn't updating, it's just showing www.fu.bar/register_step1 (when in reality, once the first form is fully validated, it should load the view AND the url www.fu.bar/register_step2)
2) I'm getting errors on form page 2 for fields, they look like this:
Undefined property: CI_Validation::$textLocationName_error
Message: Undefined property: CI_Validation::$textStreet_error
Message: Undefined property: CI_Validation::$textCity
Message: Undefined property: CI_Validation::$textCity_error
For #2: I'm trying to basically pre-populate the fields if the page reloads and not every field is validated. I'm showing errors right next to each element using this syntax:
<?php echo $this->validation->textLocationName_error; ?>
===
Could anyone chime in and help me do this form validation across multiple pages? I'm following the steps in CI's Form Validation almost verbatim, so that's what most of my code looks like.