I’m not sure how to put this, but I would like to make a dynamic form which fields come from a database, that way I wouldn’t need to do more coding if I want to have more fields in that form.
I was thinking of an attribute table where I would create the fields, but I’m not sure how to do it if I want to do ranges or If i want it to be a select with options.
Table Attribute:
- id
- -attrName -> this should be on the name attr of the input.
- -caption -> Human readable so the user knows what the field is about
- -dataType -> could be text, number, url, checkbox, radiobutton
this way, when I make a form, it will be something like this
<form> <input type=" dataType " name=" attrName "> </form>
because I assume that if someone fills the form, the table should be something like this:
- id
- attribute_id
- content
but I’m totally confused on what if I want to be able to put a range between numbers? and should I store custom error messages on the attribute table? and max and mins values?
submitted by /u/gazorpazorbian
[link] [comments]