Activiti Form viewer | ||
---|---|---|
Previous | Next | |
BPEL Process viewer | Page |
The Activiti Form viewer is the component used to render forms related to the Activiti process engine, related to either starting new processes or completing manual tasks.
A few nice-to-know items about the Activiti Form viewer:
The figure below gives a quick overview of the models available to the Activiti FormViewer:
This object contains information about the form data and form components, as well as directives used to render the form.
Property | Description | Type |
---|---|---|
currentCommand | The current command of this invocation | HashModel |
form | Directive used to print the html code for the form | FormDirective |
input | Directive used to create and render a UI component for the form | FormInputDirective |
label | Directive used to render a label for a component of the form | FormLabelDirective |
button | Directive used to render an action button | FormButtonDirective |
message | Directive used to render a message for a component of the form | FormMessageDirective |
row | Directive used to render a html row with label and input | FormRowDirective |
rows | Directive used to render html rows for many data elements | FormRowsDirective |
components | Hash with user inteface components of the form | FormComponentModel |
This object contains information about a single Activiti FormData object for the form, either a Task form or a Start form, depending on usage.
Property | Description | Type |
---|---|---|
type | Type of form data, either “TaskFormData” or “StartFormData” | String |
processDefinitionId | ID of activiti process definition | String |
processInstanceId | ID of the process instance. For a start form, this has value only after submitting the form. | String |
formKey | Form key defined on the activiti form | String |
task | Wrapped object of the underlying task. Valid only for Task forms. For detailed information, see the FreeMarker documentation of the Task class | String |
items | Map of items, with all values as strings. | HashModel |
This object, accessible through
${form.components[_componentname_]}
(e.g
form.components["task.description"]
to access the component named “task.description”), contains information about a single form component. Note that the component models are only available after the component has been created through a
form.input
reference during the initial rendering; this means that the model is always available after a redisplay of the form (e.g. if validation fails, or if you use a command which does not submit data), but that the first time you display the form, the component does not exist prior to the
form.input
reference.
Property | Description | Type |
---|---|---|
name | Name of the component | String |
bindExpression | Bind expression of the component | String |
value | Value of the component | (Any) |
Example:
<!-- Bind and value will be empty on initial rendering -->
Description: Bind=${form.components["task.description].bindExpression!}: Value=${form.components["task.description].value!}<br />
[@form.form debug="true"]
...
[@form.input name="task.description" /] <!-- Creates the component during initial rendering -->
...
[/@form.form]
<!-- Bind will not be empty during initial rendering; value might be (depends on Activiti form defintition -->
Description: Bind=${form.components["task.description].bindExpression!}: Value=${form.components["task.description].value!}<br />
This directive is used to render a
<form>
html tag. The directive must be closed at the end.
Parameter | Description | Type |
---|---|---|
debug | Set to “true” to render debug information at end of form. Optional . | String |
Example:
[@form.form debug="true"]
...
[/@form.form]
This directive is used to create a form component and render an input field for a data model item. The directive will automatically adapt its defaults according to the underlying data object’s semantics.
Parameter | Description | Type |
---|---|---|
name | Name you want to use for component; this will also be the “name” attribute in the html form. | String |
bind | Path to object you want to load data from and store data to, such as “task.description”. If not present, it will default to the “name” attribute. | String |
type | Type of input field, according to table below. Default value will depend on type of the bound object | String |
attribute | External key of iKnowbBase attribute used to determine field type | String |
<default>
|
Other parameters are rendered as they are, allowing any html attribute to be used and rendered. | String |
The input fields can take many different forms, depending on its type. The type is initially decided from the underlying data field, such that a numeric field will render as a number field. You can also specify a type manually to override this; this is particularly useful when a single field type has many possible renderings (such as a list of values, which can render as select or radio, and sometimes even as a popup).
Type | Description |
---|---|
text | Normal text input field |
number | Input field of type number |
textarea | Normal text area |
tinymce | Text area with tinymce editor |
date | Text field with date popup and date format |
datetime-local | Text field with datetime popup and format |
hidden | Hidden input field |
checkbox | Check box to toggle a boolean value on or off |
radio | Radio list (buttons), with values popuplated from underlying data field |
select | Select list (drop down), with values populated from underlying data field. |
popup | Popup button, with values populated from underlying data field. |
Examples:
<!-- Default input field -->
[@form.input name="task.title" /]
<!-- Text area and tinymce editor -->
[@form.input name="description" bind="task.description" type="textarea" /]
[@form.input name="content" bind="task.content" type="tinymce" tinymce="small"/]
<!-- Renders a dimension navigator, a drop-down to select dimensions and a user popup to select user, based on attribute definitions -->
[@form.input name="dimNavPopup" bind="task.organization" attribute="MY_ORG_DIM_ATTRIBUTE" /]
[@form.input name="dimNavSelect" bind="task.brand" attribute="MY_BRAND_DIM_ATTRIBUTE" /]
[@form.input name="userPopup" bind="task.manager" attribute="MY_USER_ATTRIBUTE" /]
This directive is used to render a label for a data model item, using the label defined in the underlying data model. For example, an Activiti Task item will have an attached label that you can render using this directive.
Parameter | Description | Type |
---|---|---|
bind | Path to object you want to render label for | String |
Example:
[@form.label bind="task.description" /]
This directive is used to render an action button for the form.
Parameter | Description | Type |
---|---|---|
name | Name of button to create. Required. | String |
action | Action you want the button to perform. Use “submit” to submit form data; leave out to just reload form. Optional. | String |
Examples:
<!-- Simple save-action -->
[@form.action name="submit" action="submit"]Complete task[/@form.action]
<!-- Three buttons, typically used on page 3 in a wizard. Use ${form.currentCommand.name} to decide which page to display -->
[@form.action name="page2"]Previous[/@form.action]
[@form.action name="page2"]Next[/@form.action]
[@form.action name="submit" action="submit"]Complete task[/@form.action]
This directive is used to render a message for a component of the form. Messages are typically the result of validation failures (for most input fields), but are also used to store errors occuring during action processing.
Examples:
<!-- A typical scenario rendering a label, an input field and an error message -->
<tr>
<td>[@form.label bind="task.valuelist" /]</td>
<td>[@form.input name="task.valuelist" attribute="SYSTEST_ATTR_VALUELIST" /]</td>
<td>[@form.message for="task.valuelist" class="validationerror" /]</td>
</tr>
<!-- Renders an error message for a "submit" button -->
[@form.action name="submit" action="submit"]Complete task[/@form.action]
[@form.message for="submit" class="validationerror" /]
Previous | Top | Next |
BPEL Process viewer | Page |