Hi,
I am developing a website which requires that you first select some data in a form (i.e. choose some time period), based on this selection I will redirect the user onto another form where there user can select some more stuff based on the previous selections.
For example I have this form with the corresponding model
CHtml::activeDropDownList($thePeriod,'period_since',$thePeriod->periodDropdown) CHtml::activeDropDownList($thePeriod,'period_after',$thePeriod->periodDropdown)
In the controller I process this like this:
// collect user input data if(isset($_POST['PeriodForm'])) { $thePeriod->attributes=$_POST['PeriodForm']; // validate user input and redirect to previous page if valid if($thePeriod->validate()) { $this->redirect("index.php?r=selection/sport&period_since=".$thePeriod->period_since."&period_after=".$thePeriod->period_after); } }
This works fine, but as I get further in this multi-step process I am passing a lot of GET variables which I do not like. Rather I wanted to do something like pass the model instances of the previous models to the next action, so instead of calling redirect I would call:
$this->actionSport($thePeriod);
This works fine, but when I render the view in the sport action it simply adds the sport view to the period view, how do I clear the view from the previous step?
And in general is there better practice for doing something like this? Where I have multiple forms that depend on the data from the previous forms (f.ex. like when you shop online and go through multiple steps and would like to be able to jump back and forward in the various checkout steps, how is it best to maintain what has been selected in checkbox etc. in all the different steps).
This was more complex to explain than I anticipated, hope this made sense to someone!
Thanks for any thoughts on this