Set the Default Value of an Input on a Start Form

SAIL Recipes give you an opportunity to explore different interface design patterns. To learn how to directly use SAIL recipes within your interfaces, see Adapt a SAIL Recipe to Work with My Applications.

Goal

Display a default value in some form inputs on a start form, and save the value into the process when submitting.

Steps

  1. Create an interface with one interface input called title (Text) and another one called date (Date).
  2. Enter the following definition for the interface, and save it as sailRecipe.
  3. In your process model, on the process start formenter the name of your interface in the search box and select it
  4. Click Yes when the process modeler asks, "Do you want to import the interface inputs?"
    • This will create parameterized process variables
  5. On the Variables Tab, give the process variables the following values:
    • caseTitle (Text): ="My default text"
    • date (Date): =today()
  6. Save and publish the process model.
  7. To view the start form in Tempo, add the process model to an application and configure it as an action. Don't forget to publish your application.

Expression

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
=a!formLayout(
  label: "SAIL Example: Default Value",
  contents: {
    a!textField(
      label: "Case Title",
      value: ri!title,
      saveInto: ri!title,
      required: true
    ),
    a!dateField(
      label: "Date",
      value: ri!date,
      saveInto: ri!date,
      required: true
    )
  },
  buttons: a!buttonLayout(
    primaryButtons: a!buttonWidgetSubmit(
      label: "Submit"
    )
  )
)

Test it out

  1. On the start form, don't modify the value of either field, and click the Submit button. Check the value of the process variables, and notice that they have the default value.
  2. Now modify the value of the text and date fields, and click the Submit button. Check the value of the process variables, and notice that they have the values you entered.
    • If you do not see the value you entered, make sure that you selected the Parameter checkbox when you created the process variable.
  3. To see what happens when the default value is incorrectly configured, remove the default value from the process variable definition. Then update the expression and set the value parameter of the text 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.
FEEDBACK