I’m trying to build a sort of form builder that’ll allow me to define, display and store ‘tests’ in a flexible way. I.e. Allow the user, through the web interface, to create a new type of test/form (“Grouping”) and define a set of fields that will be displayed on the form (any type of field, including date, text, radio, checkbox, etc). I’ll also need a results table that’ll store the values saved in each form/test.
As an inadequate example, I have the following 3 tables so far:
dd_TestGrouping
- TestGroupingID [pk]
- TestGroupingName "Algebra-1"
- TestGroupingTypeID "Math"
dd_TestFields
- TestFieldID [pk]
- TestGroupingID [fk]
- TestFieldName "Circumference"
- TestFieldType "TextBox"
- Sequence
TestResults
- TestResultID [pk]
- TestFieldID [fk]
- value "50"
- Unit "CM"
The problem with the above – if nothing else – I’m not sure how to dynamically display dropdown lists and linked radio/checkboxes. Also, how can I handle validation?
Thanks in advance for any help/pointers.
Sounds like this would be a good case for using an EAV model.