Field types
Template field
Two families of field types for displays that none of the built-in field types covers. Both store values like their base type (text, integer, decimal number) and replace only the display in the layout. What the people entering data see is described under Template field .
| Family | Field types | Edited under |
|---|---|---|
| HTML template | custom_text, custom_int, custom_decimal | Custom code › HTML template |
| Component | custom_svelte_text, custom_svelte_int, custom_svelte_decimal | Custom code › Svelte component |
With custom_int and custom_decimal the value has to remain a number; with custom_int without decimal
places.
HTML template
The template is kept in the configuration under html and is not compiled. Placeholders consisting of the
key in double curly braces are replaced before output:
| Placeholder | Content |
|---|---|
value | the stored value; with custom_int and custom_decimal the number without trailing zeros (48000, 12.5) |
formatted | with custom_int and custom_decimal the number with thousands and decimal separators (48 000, 12,5). The separators come from thousandsSeparator and radix in the configuration; if they are not given, space and comma as in the number field. For text the same value as value |
label | the field label |
field_value_id | number of the data field, usable as id in the markup |
object_id, project_id | object and project |
sample_data | sample content of the field, otherwise the value |
Further placeholders give access to the other properties of the field. Older templates with the German
names inhalt, formatiert, datenfeldID, objektID, projektID and sampledata are still filled in.
Two templates from the demo collection: “Nummernschild” (number plate; custom_int, with label_visible: false) and “Schildvorschau” (label preview; custom_text).
HTML<!-- Number plate --> <span style="font-size:150%;font-variant-numeric:tabular-nums">#{{value}}</span> <!-- Label preview --> <div style="border:1px solid #999;padding:8px;font-family:serif"><strong>{{value}}</strong></div>

For amounts of money, formatted is the right choice. With the following template a custom_decimal field
shows the stored value 48000.00000 with a thousands separator as “48 000”; the euro sign after it is part
of the template:
If the template contains an input, select or textarea, its value is saved when it changes.
Without such an element the field is display only.
Inserted values are HTML-escaped, so a value cannot smuggle in markup. The template itself is unchecked HTML. It is configuration and belongs in trustworthy hands.
Component
The source code of the component is compiled when it is saved; the result goes into the configuration
under html and is not maintained by hand. A compile error appears in the editor, a runtime error in the
field.
| Property | Content |
|---|---|
field | the whole field entry with value and configuration |
value | the stored value |
label | the field label |
object_id, project_id | object and project |
status | saving state |
bulkEdit | whether a bulk edit is running |
The component has to accept every property it uses in $props(). Otherwise the field stops with a
message such as “value is not defined”. Imports follow the rules of the browser: relative paths and
published packages work (packages through esm.sh), aliases such as $lib do not.
Of all the options in the data model, the custom component takes the most effort. An error in it affects every layout the field is placed on. And with every new Svelte version it has to be brought up to date.
Parameters
| Key | Values | If omitted | Effect |
|---|---|---|---|
html | Template or compiled module | empty | The display. Without it the field stays empty |
label_visible | true, false | true | false leaves out the standard label when the display brings its own |
Export
Exports, search and templates see the raw value, not the display. If you also need the prepared form in the export, use an output formatter or a virtual field.
When something else is the right tool
| Need | Better tool |
|---|---|
| Putting a text together from several fields | Virtual field , without code and in the export too |
| A reference to an external system that sits in the field | Link with preview |
| Thousands separators or a unit | Number with a suitable mask |
| A formatted output in the export | an output formatter |
| A repeated structure | JSON |
