HTML Form
Introduction
Starting 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 explanation text and validation error messages.
It is possible to define selection lists and compound input fields, e.g., a set of integers or a set of timestamps.
A full list of input options can be found here Data types in HTML Form
Core steps to setup HTML-Forms
| |
---|---|
| The HTML Form is created from a definition that has to be provided in an Editable Grid portlet. The portlet has to be referenced as "Buddy editable grid" in the settings of the HTML Portlet. |
Columns of the Editable Grid
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 | n/a |
6 | Value String or Selection Eingabetext | String value that is read if data type in column "Variable ID" is | n/a |
String value that is read if data type in column "Variable ID" is " The chosen val_id (= nr) is - after a selection in the Column "Werte". See code below for generating the dictionaries easily out of a comma separated list. | Text in column "Eingabetext" as a python- list with dictionaries [ leads to: | ||
7 | Infotext Hinweise | In | |
For | |||
8 | Data type Variable_ID | Data type of the item. | n/a |
9 | Usage art_type | Usage of the item. One of
|
|
10 | Error text | Text that is displayed in red letters below the info text of column 6 | |
11 | Row style | String which specifies the CSS class styling of a row. | Default styles:
Value
Multiple styles can be added when separated by a space, e.g. |
Example Editable grid
That’s how it may look like | |
---|---|
Paste it in an Edit TIS Table 4.0 | Title ID Group Bool DateTime Value Float String or Selection Infotext DataType Usage ErrorText RowStyle My first form 0 01.01 . 1900 00 : 00 : 00 Gruppe Name 0 01.01 . 1900 00 : 00 : 00 String Input Nr 0 01.01 . 1900 00 : 00 : 00 String Input |
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 (added to tisconfig).
Additional Infos
Generate the code for Selection out of comma separated text
Generate dictionary out of comma separated list
""
" Für Elearning Aufbau der spezifischen Spalten"
""
#C:\Repository\calculex\AZR_220828_simple_mains_und_Reste\simple_main_EL_Selection aufbereiten.py
import json
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 = json.dumps( [ {
"val_id"
: f
"{i}"
,
"val_text"
: el}
for
(i, el)
in
enumerate(liste_werte, 1)])
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
"}
]
"
""