Welcome Guest, Not a member yet? Register   Sign In
Multi-step form using validation?
#1

[eluser]SilverTab[/eluser]
I'm trying to make a multi-step form (where each step uses data that was submitted by the previous step)...That part, I know how to do, the problem is.. I'm not sure how I can use CI's validation library in such a context...

From what I understand, to use the validation (I'm using it on another form) I have to submit the data to the same controller->function that displays the form... so that if it fails, the form can still be displayed with the error messages right??

So, keeping that in mind, let's say I do a redirection to step 2 of my form when the validation has passed... wouldn't I lose all my POST data from the previous form ??

Any clue/tips would be appreciated! Smile
#2

[eluser]Colin Williams[/eluser]
My assumption is that completed data would be temporarily stored in a session or database table. No sense in tossing the $_POST data around everywhere. When on subsequent "steps," you can check that the previous data is stored. You could even just save an indication of the step the user is on and check against that.

For validation, it sounds like all you need to do is conditionally load rules and fields for the given "step" of the form, and just the same, conditionally load the correct View.
#3

[eluser]SilverTab[/eluser]
Yeah session does make sense... I'll give it a try! Thanks




Theme © iAndrew 2016 - Forum software by © MyBB