HTML Form
Staring from v 6.9 via HTML (Portlet). The HTML Form provides a user interface to enter data in a form-based way. It allows to add text for explanation of validation error messages and provides extra data types, e.g., selection lists or lists of integers for constraint settings.
The HTML Form is created from a definition that has to be provided in an Editable Grid portlet. This definition is processed by a JavaScript script.The portlet has to be referenced as "Buddy editable grid" in the settings of the HTML Portlet.
The Editable Grid contains the definition of the form items or sections as follows. Columns indices are relevant rather than column names, so the column names can differ between applications. More columns can be added for other purposes, e.g., error handling.
Column index | Common column names | Description | Screenshot |
---|---|---|---|
0 | Title Frage | Header of the form items | |
1 | ID Id | Identifier of the item for internal use. | n/a |
2 | Group Gruppe | Group name, if the item belongs to a group. The group name has to be defined in a separate row. | |
3 | Value Bool or NullableBool | Boolean value that is read if data type | |
Boolean value that is read if data type | Then the box is empty at the beginning thereby allowing to distinguish, whether false=Nein | ||
4 | Value DateTime Datum | DateTime value that is read if data type in column | n/a |
5 | Value Float Werte | Float value that is read if data type in column "Variable ID" is Double. | n/a |
6 | Value String or Selection Eingabetext | String value that is read if data type in column "Variable ID" is String. | n/a |
String value that is read if data type in column " The chosen val_id (= nr) is - after a selection in the Column "Werte". See code below for generating the dictionaries easily | Text in column "Eingabetext" as a python- list with dictionaries [ leads to: | ||
7 | Infotext Hinweise | In Output and Input rows: | |
For Gruppe it produces an additional row spanning all columns just | |||
8 | Data type Variable_ID | Data type of the item. | n/a |
9 | Usage art_type | Usage of the item. One of
| n/a |
10 | Error text | Text that is displayed in red letters below the info text of column 6 |
Advanced Settings
The form in simple_form.html is delivered by TIS. It can be customized in TISBoard/portal/simple-form/custom.css for branding.
Generate the code for Selection out of comma separated text
""
" Für Elearning Aufbau der spezifischen Spalten"
""
#C:\Repository\calculex\AZR_220828_simple_mains_und_Reste\simple_main_EL_Selection aufbereiten.py
SPALTE_SELECTIONSTEXT =
'Eingabetext'
SPALTE_GRUPPE =
'Variable_ID'
def simple_main(params, mylist, types, columns):
""
"Baut Spalteninhalt für SELECTIONSAUSWAL HTML FORM auf."
""
col_gru = columns [SPALTE_GRUPPE]
col_sel = columns [SPALTE_SELECTIONSTEXT]
# Werte
in
entsprechende Spalte
for
row
in
mylist:
if row[col_gru] ==
'Selection'
:
txt = row[col_sel]
liste_werte = (txt.strip()).split(
','
)
# liste_werte = [
'-'
] + (txt.strip()).split(
','
) # adds the value -
at
the beginning
of
the list, so nothing
is
selected automatically.
res =
'[\n'
for
i, el
in
enumerate(liste_werte):
el = el.strip()
elstr =
'{ "val_id" : '
+ str(i + 1) +
', "val_text " : "'
+ el +
'" }'
res += elstr +
', '
res +=
']'
row[col_sel] = res
return
myl
""
" ZIELFORMAT
[
{"
val_id
" : 1, "
val_text
" : "
Woche
"},
{"
val_id
" : 2, "
val_text
" : "
Monat
"}
]
[
{"
val_id
" : 1, "
val_text
" : "
x08:00
"},
{"
val_id
" : 2, "
val_text
" : "
x05:30
"},
{"
val_id
" : 3, "
val_text
" : "
x09:00
"}
]
"
""