Same Form For Various Controllers


I’m kind of new on Yii, and spent last day all searching for this answer…

And I can’t decide what’s the best way to do it, so…

In my webapp I have altot of graphs and reports.

Basically works this way…

  1. Present a form/dialog to get data (like date range, year range…)

  2. Controller get the range and send to Model

  3. Present the view (Graph or report)

This form/dialog used to get the range will be used alot from various actions Controllers.

So my question is: How can I write this form only once and use it on many actions I need to?

Thx in advance.

If controller’s actions have same fields to use in the form, make a form file and use renderPartial in they’re view files, else make some view files and use CForm to make dynamic forms.

Thx for your answer.

I’m going to dynamic forms way.