Question types:
A question consists of question types. These types describe how a question should be rendered. The description is done in JSON format and is contained in the "Json" column of the QuestionType table.
Here the basic json format:
[
{
"inputTemplate": "TEMPLATE WITH PLACEHOLDER {VARIABLE_NAME}"
"inputs": [
{
"type": "TYPE",
"variable": "VARIABLE_NAME",
}
]
}
] |
Currently the following input types are supported:
| Type | Example | Ausgabe |
|---|
| number | [ { "inputTemplate": "Soll: {targetPreasure} bar", "inputs": [ { "type": "number", "variable": "targetPreasure" } ] } ] | |
| text | [ { "inputTemplate": "Bezeichnung: {description}", "inputs": [ { "type": "text", "variable": "description" } ] } ] | |
| radio | [ { "inputTemplate": "", "inputs": [ { "type": "radio", "label": "Ja", "value": true, "variable": "result" }, { "type": "radio", "label": "Nein", "value": false, "variable": "result" } ] } ] | |
| checkbox | [ { "inputTemplate": "", "inputs": [ { "type": "checkbox", "label": "Druckprüfung", "variable": "result1" }, { "type": "checkbox", "label": "Temperaturprüfung", "variable": "result2" } ] } ] | |
| date | [ { "id": "druck", "inputTemplate": "", "inputs": [ { "type": "date", "label": "Druckprüfung", "variable": "result" } ] } ] | |
| range | [ { "inputTemplate": "Druck: {druck}", "inputs": [ { "type": "range", "variable": "druck", "min": 10, "max": 350, "step": 10 } ] } ] | |
| textarea | [ { "inputTemplate": "Beschreibung", "inputs": [ { "type": "textarea", "variable": "result" } ] } ] | |
| picture | [ { "inputTemplate": "Foto", "inputs": [ { "type": "picture", "variable": "photo" } ] } ] | |
Detailed
number
[ { "inputTemplate": "", "inputs": [ { "type": "number", "variable": "targetPreasure", "label": "Druck: ", // instead of the inputTemplate a label can be set which is display above the input "decimalDigits": 2, // sets the number of decimal digits - default 0 "thousandSeperator": true, // controls if a thousand seperator should be shown - default false "style": "background-color: lightblue;" // custom style } ] } ]
| |
|---|
text
[ { "inputTemplate": "", "inputs": [ { "type": "text", "variable": "description", "label":"Bezeichnung: ", "style":"color: red" } ] } ] | |
|---|
radio
TODO: iconvisible, deselectable not working - check color
[ { "inputTemplate": "", "inputs": [ { "type": "radio", "label": "Ja", "value": 1, "variable": "result", "iconVisible": false, "color": "btn-primary" }, { "type": "radio", "label": "Nein", "value": 2, "variable": "result", "deselectable": false, "color": "btn-secondary" }, { "type": "radio", "label": "Vielleicht", "value": 3, "variable": "result", "deselectable": false, "color": "btn-success" }, { "type": "radio", "label": "Weiß nicht", "value": 4, "variable": "result", "deselectable": false, "color": "btn-danger" } ] } ] | |
|---|
checkbox
[ { "inputTemplate": "1: {result1} 2: {result2}", "inputs": [ { "type": "checkbox", "label": "Druckprüfung", "variable": "result1", "color": "btn-success" }, { "type": "checkbox", "label": "Temperaturprüfung", "variable": "result2", "color": "btn-danger" } ] } ] | |
|---|
date
[ { "id": "druck", "inputTemplate": "", "inputs": [ { "type": "date", "label": "Druckprüfung", "variable": "result", "customFormat": "YYYY/MM/DD", "useCurrent": true, "minDate": "2023/01/01", "maxDate": "2024/01/01" } ] } ] | |
|---|
textarea
[ { "inputTemplate": "Beschreibung", "inputs": [ { "type": "textarea", "variable": "result", "rows":10, "placeholder": "placeholder..." } ] } ] | |
|---|