How to conditionally show or hide sections of a work object form
For V6+ please refer to How to conditionally show or hide portions of a work object form.
Some work object forms are large and complex. To make this aspect of your BPM application more user-friendly, you can use the conditional display feature to hide or display parts of these forms, based on actions that your users perform. For example, Figure 1 and Figure 2 show an application where a form's Address fields are hidden until the user selects the Add Shipping Details check box:
Figure 1. The Purchase Order Form with Add Shipping Details Check Box Unchecked
Figure 2. The Purchase Order Form with the Add Shipping Details Check Box Checked
There are two steps in implementing conditional displays:
1: Set the Controlling Field
Complete the following steps to set a controlling field:
- Open the Harness or Flow Action rule that you want to include a conditional display.
- Click the icon to turn on wireframes.
- Select the field that you want to be the controlling field. The Field panel appears at the bottom of the left pane.
- Find the Client Event row in the Field panel of the screen (Figure 3) and click the icon.
Figure 3. The Client Event Field
- The Client Event Editor appears (Figure 4):
Figure 4. The Client Event Editor
- Select one of the following values for the Event field:
- OnChange — Associates an event with properties presented as a text box, text area, or selection. The event occurs whenever the contents of the input field changes. This is most useful for selection lists; by using OnChange instead of OnBlur the action can occur immediately.
- OnBlur — Associates an event with properties presented as a text box, text area, or selection list. This event occurs when the input field on the form loses focus; for example, when the user presses the Tab key or clicks in another input field.
- OnClick — Associates an event with properties presented as a check box or set of radio buttons. The event occurs when the user clicks the the check box or radio button.
- Use the Action drop down to select one of the following actions:
- Hide/Show Elements — Causes properties, sections, or layouts (the controlled elements) to become visible or hidden dynamically, based on the value of this controlling property.
- Refresh This Section — Causes the section to be refreshed, based on the value of this controlling property. The updated form may contain different values supplied by an activity.
If you selected Refresh This Section for the Action field (Figure 5), you can use the Activity field to call an activity that changes the content of the section. To find the activity at runtime, the system uses the Applies To class of this rule with rule resolution. Use the Params button to specify the activity's input parameters, if any.
Figure 5. The Client Event Editor with the Refresh this Section Action Selected
- Click Save to save your changes.
2: Set Conditions for the Controlled Element
At runtime, a controlled element is visible or hidden dynamically. You can control the following elements:
- Fields in a cell
- A layout
- An included section
- A container in a harness rule
Complete the following steps to set the conditions for the controlled element:
- Open the rule that contains the element that you want to control.
- Click the icon to turn on wireframes.
- Select the field, layout, section, or container that you want to be the controlled element.
- Go to the Field, Layout, Section Include, or Container panel and fill out the Visible When field. Enter a test condition for the property value in the controlling field. Provide a comparison of the property with a constant value using one of the following operators:
- Unless the Type of the property is Integer, TrueorFalse, or Decimal, place a pair of single quotes around the string constant. For example, the test condition shown in the Visible When field of Figure 1 is what controls the display of the address fields in Figure 2 .
- Select the Run on Client? check box (Figure 6) to enable the controlled element.
Figure 6. The Run On Client Check Box
Published February 8, 2007 — Updated February 8, 2007