Hi,
I’ve searched through the forums and I haven’t seen any solution to a problem that goes like this:
In my app I let my users to create Questions that contain multiple choice Answers (and everything is saved in the DB).
For example
Q1. What is your Gender:
A1. Male
A2. Female
Q2. What is your Age Group:
A3. 10-20
A4. 20-40
A5. 40-60
A6. 60+
etc, etc
Questions and Answers are each db tables holding the data.
Questions Table | Answers Table
================================================
id | question | id | answer
----+----------------------- | -----+----------
1 | What is your Gender | 1 | Male
2 | What is your Age Group | 2 | Female
| 3 | 10-20
| 4 | 20-40
| etc | etc
After the users define their Questions and Answers they can combine them in different Questionnaires. A user can select Questions Q1, Q5 and Q13 to form his Questionnaire.
Now, I want to display a form with these three specific questions and show some checkboxes (or radio buttons) underneath each question, and then collect the answers!
Obviously I cannot create a model for the Questionnaire because at runtime I do not know the contents of it. Reading through the CForm Builder tutorial I can easily create the CForm needed (by collecting the necessary info from the DB) but I do not know what kind of model to bind it with.
What is the missing link that I’m, well… missing?
In other words, how can I have a dynamic model together with a dynamic form in order to collect the form data…?
Thanks in advance!