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?