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.
To include combo box values you need to extend your model via something like this:
dd_TestFields
- TestFieldID [pk]
- TestGroupingID [fk]
- TestFieldName "Gender"
- TestFieldType "Combo Box"
- Sequence
with a new table:
dd_TestFieldSelection
- TestFieldSelectioniD [pk]
- TestFieldID [fk]
- TestFieldValue "Female"
- Sequence
Validation i think naturally belongs in your dd_TestFields table:
dd_TestFields
- TestFieldID [pk]
- TestGroupingID [fk]
- TestFieldName "Age"
- TestFieldType "Number/Text Box"
- Sequence
- Required "True"
- MinValue "0"
- MaxValue "150"
This is just a rough sketch but you can extend the ideas as you see fit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With