Multi-page form with Yii in a Craft site? I have a Craft-based website and need to make a complex multi-'page' form on one page. The form isn't related to any Craft Entries etc, and doesn't need to save the submitted data to Craft's database (it's sent to a different database).

Having looked at a few form-related Craft plugins, I think I'll be best writing this from scratch. I'm experienced with PHP, but not Yii and I'm not quite sure how best to structure this within a page that will be generated by Craft (an Entry).

I'm guessing I could write a plugin and a variable in it is used in the Craft template to generate the form. Given that, some questions:


Should I create a series of Yii forms, one per 'page' of the form, and use the one indicated by a hidden 'step' form field?
Is there any issue with saving data to Yii sessions (for each form step's inputs) within a Craft site?
I could have templates for the different form 'pages' in my plugin. How would I pass data from the form (fields, submitted data, error messages) to the template?


I guess I'm also looking for general responses of either "This looks like a sensible route to explore" or "OMG don't go that way, there are monsters!" :)

EDIT: I think I should be using the plugin's Controllers to handle form submission, passing data to templates etc. Rather than having a plugin variable in a Craft Entry's template. Maybe I can integrate Yii forms with those Controllers?
I wouldn't worry going so far outside of Craft and using Yii's forms.

Sounds like all you need is a Craft plugin.  Use normal HTML &lt;form&gt;s from  your template and have them post to your plugin's Controller.  Each step in the form can be another action on the controller.  You can persist data between form steps by saving to Craft's HttpSessionService, which is just a thin wrapper for PHP's global $_SESSION variable.

craft()-&gt;httpSession-&gt;add($key, $value)


and:

craft()-&gt;httpSession-&gt;get($key)