Obtain model after redirect


I have a problem how could I get a reference to the model after being redirect?

public function actionList()


	$form=new Report;




		if( $form->validate() )







 * Shows a particular model.


public function actionShow()




I used above methods but the $form is not available on the show.php view.

Help me please…



redirect() makes a completely new page request. Think of it as automatically typing a new URL in the user’s browser and then pressing enter. You will need to define $form in your show action.

Why don’t you use?

if( $form->validate() )


I had the same issue with a search form recently, I didn’t want to render the page in place due to URL consistency (I would end up showing the original search form in /search/results instead of just /search if the form wouldn’t validate).

Anyway, I ended up caching the model for 5 seconds and checking for the existence of a cached model on the redirected page. Not really an elegant solution but the best I could come up with for now…