Tip: Interface patterns give you an opportunity to explore different interface designs. Be sure to check out How to Adapt a Pattern for Your Application.
Display a default value in some form inputs on a task form, and save the value to process when submitting.
="My default text"
. Save the node input into a process variable.1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
=a!formLayout(
label: "Example: Default Value",
contents: {
a!textField(
label: "Case Title",
value: ri!title,
saveInto: ri!title,
required: true
)
},
buttons: a!buttonLayout(
primaryButtons: a!buttonWidget(
label: "Submit",
submit: true
)
)
)
value
parameter of the textField component to ="Default text from the component"
. View the form and submit without modifying the text field. Notice that the corresponding process variable does not have the default value.Watch out! A common mistake is to use load() and to configure a local variable called ri!title as follows:
1
2
3
4
=load(
ri!title: "Default text",
...
)
The expression doesn't result in the intended behavior because load()
only creates local variables. In the above example, a local variable called ri!title is created, with this default value, but its value is not saved in process. Load variables must only be used for data that are not saved back into the process.
Set the Default Value of an Input on a Task Form