[eluser]adamfairholm[/eluser]
Hey there -
I've poked around for a bit and haven't found an answer to this, so here we go. May be an obvious answer but for some reason it isn't coming to me.
I'm trying to do a two step form with CI validation. So the process goes like this:
FORM 1 - User inputs some data, it gets validated by CI and the form data is passed to the next form.
FORM 2 - Some more info (dependent on the first form's info) is filled out.
The problem I'm running in to is being able to set validation for both of these forms. I know for CI validation to work your form action needs to be the same method that displays the form, which leaves me in a bind because if the second form validates it's going to just reload and if it doesn't it'll go back to the first form.
Here's some psuedo code:
Controller:
Code:
<?php
//Validation Rules for first_form
if ($this->validation->run() == FALSE) {$this->load->view('forms/first_form', $data);}
else {
//if validation says everything is cool, send data to second form.
$this->load->view('forms/second_form', $data);
}
?>
Is there a much better way of doing this that I'm overlooking?