Forms Human Task
Forms Human Task
Forms Human Task provides a possibility to set up a Human Task which contains several form elements. The task supports the next set of fields:
- Simple text (single line input field) (type input);
- Multiline text (multiline input field) (type textarea);
- Date picker (type date);
- Radio buttons (elements of single choice) (type radio_group);
- Select dropdown lists (single choice from the list of values, better if you have a long list to choose from) (type select);
- Checkbox for multiple choice (multiple choices from the list of values) (type checkbox_group);
- Checkbox for single-choice (type checkbox);
- Number (type number_input);
- Information field (type info);
- File upload (type file_input)
The question list might be divided into separate blocks using groups. They are set up in the settings as an array of input fields.
Document Type JSON Structure
Here is an example of a settings object that defines the form:
These settings contain:
- autoSave (boolean) (optional) - allows saving intermediate task results automatically. By default, the setting has a "false" value.
- appLanguage (string) (optional) - allows the user to set up the Human Task localization. Currently available options are "en" and "ru". By default, the task displays as "en".
- showOrderNumber (boolean) (optional) - allows displaying the position of the item in the group. By default, the setting has a "false" value.
- minWidth (number) (optional) - specifies minimal width of form in pixels.
- groups (list of objects) (required) - list of group settings. Each group in the list has the following structure:
- groupTitle (string) (required) - identifies the group name to display in Human Task.
- fields (list of objects) (required) - list of field settings. Each field in the list has the following structure:
- name (string) (required) - is used as a key to get value from the output result. It's never displayed on the Human Task and must be unique for the entire form. Required for the following types: input, number_input, textarea, date, radio_group, select, checkbox, checkbox_group, date.
- label (string) (required) - label to display on Human Task.
- type (string) (required) - specifies the type of field. Should be one of the supported types: input, number_input, textarea, date, radio_group, select, checkbox, checkbox_group, info, date, block.
- fields (list of objects) (required) - is used only if "type": "block". Structure the same as "groups.fields", except that field "type" does not support value block block. Field will be placed horizontally.
- title (string) (optional) - is used only if "type": "block". Identifies name for horizontal fields group to display.
- withBorder (boolean) (optional) - is used only if "type": "block". Specifies whether add border for horizontal field group.
- required (boolean) (optional) - shows if the field is required for filling, so the user won't be able to submit Human Task without specifying the values for all required fields.
- multiple (boolean) (optional) - is used only if "type": "select". Allows to select multiple items in the select dropdown list. Can work with autocomplete setting.
- autocomplete (boolean) (optional) - is used only if "type": "select". Allows to search by items in the select dropdown list. Can work with multiple setting.
- mask (string) (optional) - is used only if "type": "input". Allows to set a string of characters that indicates the format of valid input values. Default format characters: "9" for 0-9 characters; "a" for A-Z and a-z characters; "" for A-Z, a-z, 0-9 characters. If required to have exactly "9" character (e.g., a phone code), use "\" before the character (e.g., "+4\9 99 999 99"). If "required": true and a mask are set for "type": "input", input must be filled completely according to the mask.
- minRows (number) (optional) - is used only if "type": "textarea". Specifies the minimum number of lines to display in the textarea. By default, the setting has the value "2".
- maxRows (number) (optional) - is used only if "type": "textarea". Specifies the maximum number of lines to display in the textarea without a scroll appearing. If the number of rows is not within maxRows setting, a scroll appears. There is no default value and the field grows without limit.
- disabled (boolean) (optional) - provides the possibility to disable the field which will prevent the user from filling this field.
- validationRegExp (string) (optional) - provides possibility to validate filled values using regular expressions.
- description (string) (optional) - allows to add a description to a field. Can be added for the following types: input, number_input, textarea, date, radio_group, select, checkbox, checkbox_group, date.
- errorMessage (string) (optional) - is used to set the text for the error if the filled values do not match the regular expression in validationRegExp setting.
- items (list of objects) (required only for "type": "checkbox_group", "radio_group", "select") - is used only if "type": "checkbox_group", "radio_group","select". Specifies possible items to check. Each item in the list has the following properties:
- value (string) (required) - the value of the item to display.
- label (string) (optional) - the label of the item to display. If no label is set, value is displayed instead. If both settings are set, label is displayed on Human Task, but value is set in Human Task Output.
- disabled (boolean) (optional) - provides the possibility to disable the item which will prevent the user from selecting it.
- markLabel (string) (optional) - is used only if "type": "checkbox". Displays the label of the checkbox.
- text (string or array) (optional) - is used only if "type": "info". Displays uneditable text for info field. If the text contains an array of strings, each string will be considered as a new paragraph.
- keyboard (boolean) (optional) - is used only if "type": "date". Allows to enable manual date entry for datepicker field. By default, the setting has the value "false".
- bucket (string) (required) - is used only if "type": "file_input". Specifies the name of the bucket in MiniO S3 in which the files added by filling out the form will be stored.
- path (string) (required) - is used only if "type": "file_input". Specifies the name of the folder in MiniO S3 bucket in which the files added by filling out the form will be stored.
- accept (string) (optional) - is used only if "type": "file_input". Specifies the type of files to be filtered in File Explorer.
format (string) (optional) - is used only if "type": "date". Allows to set a custom date format. By default, the setting has a "MM/DD/YYYY" value. Supports the following formatting tokens for dates:
Input JSON Structure
Input JSON contains the structure and fields description of the customizable form that is displayed on the Workspace. It can be configured similarly to Document Type Settings. If Input JSON is not filled in, fields from Document type settings will be displayed by default. The following additional settings can be used in Input JSON:
overrides (optional) - allows overriding the field and its options from Document Type Settings if it is used as default Input. The field to be overridden should be declared in the block by its name. Then settings of the field to be overridden has to be declared and defined. Please note, that "name" and "type" cannot be overridden.
messages (optional) - allows displaying the block with a message or several messages. The block can be configured with various severity parameters: "info", "warning", "error".
Here is an example of Input JSON in which override and messages sections are defined:
Output JSON Structure
The Output JSON consists of key-value pairs. Key is the unique name of the field specified in Document type settings or Input JSON on the form, and value indicates the value chosen during form processing.