Currently there is no editor for these input forms, so these have to be hand-written.
The basic structure of a form template is as follows:{
"version": "1.0",
"title": "Title",
"requireClaim": true,
"column": [ ]
}
“title” is the title text that is normally displayed above the form.
”requireClaim” indicates if the user must claim the form before editing the values. This field is optional (default false).
”column” is an array of all the fields in the form.
A minimal form with one field could look like this:
{
"version": "1.0",
"title": "Title",
"column": [
{
"id": "customerNumber",
"type": "number",
"label": "Customer number",
"path": "/root/header/customerNumber",
"required": true
}
]
}
It is possible to use a number of different field types in the form: Text input, numeric input, selection drop-down, resource selection browser and checkbox.
It is also possible to place up to 3 fields in the same row by using the “row” field type.
For all types (except row), a number of common mandatory fields must always be present:
Name | Type | Description |
id | string | A unique (within this form) field id. |
type | string | The field type. Valid values are: text, number, select, checkbox, row |
label | string | The label text that is displayed for this field. |
path | string | The path within the XML of the element that holds/should hold this value. This is written in XPath notation, e.g. /root/header/customerNumber For elements within arrays, an attribute must always be used to indicate the exact element within the array, e.g. /root/body/product[@index='1']/name Since this is a JSON file, the attribute should be in single quotes instead of double quotes. |
Name | Type | Description |
row | JSON array | An array of 2-3 regular fields |
Name | Type | Description |
required | boolean | If the form field must have a value before the form can be submitted. |
readOnly | boolean | If the field should be read-only (not editable in the form). |
tooltip | string | A helpful tooltip to display on the form field. |
multiline | boolean | If the field should allow multiple lines of text. |
validation | JSON object | Validation rules, see below. |
Name | Type | Description |
min | integer number | Minimum number of characters. |
max | integer number | Maximum number of characters. |
pattern | string | Regular expression in Javascript format (same as Java really). The input is valid if it matches the regular expression. Test it for instance on https://regex101.com |
Name | Type | Description |
required | boolean | If the form field must have a value before the form can be submitted. |
readOnly | boolean | If the field should be read-only (not editable in the form). |
tooltip | string | A helpful tooltip to display on the form field. |
validation | JSON object | Validation rules, see below. |
Name | Type | Description |
min | integer number | Minimum value. |
max | integer number | Maximum value. |
Name | Type | Description |
readOnly | boolean | If the field should be read-only (not editable in the form). |
tooltip | string | A helpful tooltip to display on the form field. |
Name | Type | Description |
required | boolean | If the form field must have a value before the form can be submitted. |
readOnly | boolean | If the field should be read-only (not editable in the form). |
tooltip | string | A helpful tooltip to display on the form field. |
options | Array of string | The list of values to display in the drop-down. This should only be used for a fixed set of values. Example: ["Denmark", "Finland", "Norway", "Sweden"] |
optionsRef | string | ID of the NG2 value list to display. Example: “CHAR_ENCODING" The names of all available lists can be found from: https://localhost:8086/rest/forms/getFieldOptions (where localhost is to be replaced with the IP-address or host name of the InterFormNG2 server). |
optionsPath | string | Path within XML to an array containing the values for the drop-down. The elements in the array must have an attribute with a unique value. |
optionsKeyAttr | string | When using optionsPath, this should be the name of the attribute that is used as index in the array. The value of this attribute is used to indicate the selected element in the drop-down. |
Name | Type | Description |
required | boolean | If the form field must have a value before the form can be submitted. |
readOnly | boolean | If the field should be read-only (not editable in the form). |
tooltip | string | A helpful tooltip to display on the form field. |
optionsResource | string | The library to display resources from. Valid values: templates, translations, images, fonts, documents, mailTemplates, templateComponents, styles, others |
resourceFolder | string | Optional default folder in which the browser should open. |