Select/Deselect all Selections in a Choice Control
kbt155770
PRODUCTK2 Five
K2 smartforms 4.7
TAGSHow to Document
This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.
Objective
To select and deselect all items in a Choice control on a single click.
Before You Begin
This is applicable to a Choice control configured to display as a Check Box List as it allows multiple selections.
How-to Steps
- Add a Check Box control called Select All Check Box that will be used to either select or deselect all the items in the Choice control.
- Drag a Text Area control to the canvas. This will be used to set the value of the Choice control.
- Create an unbound rule called For All Choices as follows:
- for All tems in Choice list control
- then transfer data
Configure the Transfer Data action so that it passes the ID of the SmartObject bound to the Choice control to the Text Area control with the Text Area appended:
- Add a rule for when the Select All Check Box control is changed, it toggles the selection on the items in the Choice control.
On the else clause, map the Text Area control to an empty value.
Outside the if-else, call a transfer data so that the value of the Text Area control is mapped to the Choice control.