General Component Configuration
There are configurations that apply to all components.
Label label
Most components allow for a label. The specific display format depends on the component. A string can be specified directly. For multilingual support, an object containing strings for multiple languages can be specified.
{
"label": {
"LANGUAGE-1": "String in language 1",
"LANGUAGE-2": "String in language 2",
"LANGUAGE-n": "String in language n"
}
}
{
"label": {
"de": "Hallo Welt",
"en": "Hello world"
}
}
See also Multilingual Content
Icon icon
Most components offer the option to display an icon.
The specific display format depends on the component.
The icons come from the library Font Awesome Pro.
A Font Awesome CSS class can be specified directly as a string.
|
The renderer supports all Font Awesome icons from version 5.15.4 (Pro version) |
{
"icon": "font-awesome-css-class"
}
{
"icon": "fal fa-fire"
}
Type type
Each component must correspond to a type. You can view this for the respective component.
Restrictions on Use
Using readOnly, disabled, hidden, and required, you can modify how components are used by users.
If a user is to have read-only access to a component without being able to modify its content, the readOnly attribute can be used.
This attribute is intended for text fields; it does not alter the design and affects only write permissions.
The ` disabled ` attribute allows you to completely disable interaction with a component.
This attribute can be used for all components that support interaction.
When components are ` disabled , this is clearly indicated.
The ` `hidden ` attribute can be used to hide components.
If a component is ` required , the user is required to enter data.
These attributes can be set either via data binding or directly at `true.
Example readOnlyDisabledHiddenRequired.json
{
"$schema": "https://forms.virtimo.net/4.2.x/schema.json",
"metaData": {
"id": 0,
"version": 0
},
"configuration": {
},
"components": [
{
"type": "container",
"label": "readOnly disabled hidden required",
"components": [
{
"type": "checkbox",
"value": "/data/appearance/hidden",
"label": "hide"
},
{
"type": "checkbox",
"value": "/data/appearance/disabled",
"label": "disable"
},
{
"type": "checkbox",
"value": "/data/appearance/readOnly",
"label": "make read only"
},
{
"type": "checkbox",
"value": "/data/appearance/required",
"label": "make required"
},
{
"type": "textfield",
"hidden": "/data/appearance/hidden",
"required": "/data/appearance/required",
"disabled": "/data/appearance/disabled",
"readOnly": "/data/appearance/readOnly"
},
{
"type": "textfield",
"value": "Durchgehend disabled",
"disabled": true
}
]
}
],
"state": {
"data": {
"appearance": {
"hidden": false,
"disabled": false,
"readOnly": false,
"required": false
}
}
}
}
Action when a field’s value changes onChange
Field configuration
|
This configuration can only be applied to input fields, such as Text Field or Date Field. |
When a field’s value changes, a specific action can be executed.
The following actions are supported:
-
getFormState: For this, a
stateUrlmust also be set, from which the new states are provided. When the value changes, the form requests the URL and inserts the returned states into the fields.
|
The |
-
validate: Triggers form validation.
{
"components": {
{
"type": "textfield",
"label": "Text field",
"onChange": {
"action": "getFormState",
"data": {
"stateUrl": "http://localhost:3000/loadState/addressDirectory"
}
}
}
}
}
{
"components": {
"type": "textfield",
"label": "Text field",
"onChange": {
"action": "getFormState"
}
},
"configuration": {
"stateUrl": "http://localhost:3000/loadState/addressDirectory"
}
}
{
"type": "checkbox",
"label": "Check validation",
"onChange": {
"action": "validate"
}
}
Response Format
The server must return the response in the correct format so that the form can be updated. The response should be in the form of a JSON object containing the following attributes:
-
result:successorfailure
|
In the event of an error, additional attributes should be defined to notify the user of the error. |
-
action: It must contain the valuesetFormStateso that the form is updated. -
data.state: Contains the new states.
{
"result": "success",
"action": "setFormState",
"data": {
"state": {
"address": {
"street": "Behrenstraße",
"number": 18,
"city": "Berlin",
"country": "Deutschland"
}
}
}
}
{
"result": "failure",
"message": "Fehler im Server"
}
Responsive Configuration responsiveConfiguration
For configurations that dynamically adapt to the given size or devices used, see Responsive Forms.
Generic Configuration configuration
The configuration attribute can be used to pass any parameters to the component.
These are passed to the renderer when the components are created and interpreted accordingly.
This allows, for example, functions not directly supported by the components to be controlled.
|
This option should be used with caution. An incorrect configuration can cause the form to no longer function as expected. |
Various display parameters
The following attributes can be used to influence the component’s appearance.
- minWidth
-
Minimum width
- minHeight
-
Minimum height
- width
-
Width
- height
-
Height
- maxWidth
-
Maximum width
- maxHeight
-
Maximum height
- flex
-
Specifies how the component may expand within its Container. To do this, the
flexvalues of all Components in the Container are compared relative to one another.