[eluser]Chillahan[/eluser]
I have a multi-page registration form process. To go page to page I am doing:
Code:
if ($this->validation->run() == FALSE)
{
// load the view for the current page again, which will also show validation errors;
}
else
{
// load view for the next step;
}
However, when I load the view for the next step, it will show a validation error, even though the user has not had a chance to enter data yet. If, instead, in the else case, I use the redirect() function, then of course it works. I assume the validation class is using some sort of cookie to store whether the page it is validating has already been viewed once or not (based on URL), and so when I use load to get the next page up it fails and shows an error right away (since URL looks the same).
Now, I realize that using redirect is pretty simple, but I still think using load is cleaner since it avoids doing a redirect. Originally I thought it would be more secure too, since I could make the other registration steps more private by prefixing hem with _, but then quickly realized that doesn't work since then a user can't view the second steps or beyond if they don't enter data correctly (since those steps' forms do submit to their own controllers).
Perhaps I am just being silly and the only way to do it is to redirect to the next form page upon successful completion of the current page? I am having to check cookie/session data anyway to ensure people can't skip to the middle of the registration process, so really this is becoming more of a theoretical question.