Multiple master checkboxes in the statements component

Single master checkbox

By default the declarations component is displayed with a single master checkbox. Regardless of the number of controls, such a checkbox selects them all.

Illustration 1. Example appearance of declarations with a single master checkbox for one control (depending on the implementation the appearance may vary)

Illustration 2. Example appearance of the component with a single master checkbox for two controls (depending on the implementation the appearance may vary)

Multiple master checkboxes

To display two or more master checkboxes, first define them by clicking Add masterCheckbox in the field MASTER CHECKBOX LIST (masterCheckboxes).

Illustration 3. Master checkboxes List window with a defined list of two main checkboxes
1

Define master checkboxes

For each master checkbox you must define:

  • mastercheckboxId — The Id that will identify the master checkbox for the controls

  • labelKey — The text key that will be displayed for the master checkbox with the given id

  • visibleCondition — The visibility condition for the master checkbox. Default value: "true".

2

To link a master checkbox to a control, enter the master checkbox id in the control definition. You should add the appropriate entries in the component's JSON (more about creating declarations in Declarations editor).

Example (JSON fragment) showing adding master checkboxes "mCh1" and "mCh2" for declarations:

fragment.json
"items": [
    {
        "controls": [
            {
                "mid": "control1",
                "titleKey": "control1",
                "requiredCondition": "js:false",
                "mastercheckbox": "mCh1",
                "type": "CHECKBOX"
            },
            {
                "mid": "control2",
                "titleKey": "control2",
                "requiredCondition": "js:false",
                "notSelectedErrorTextKey": "",
                "mastercheckbox": "mCh2",
                "type": "CHECKBOX"
            }
        ]
    }
]
Illustration 4. Example declarations with three master checkboxes (depending on the implementation the appearance may vary).

When only one master checkbox is visible, the declarations will look like below. The master checkbox key will not be displayed; instead a default description will appear. In this case the behavior of the master checkbox does not change and it still selects only those controls that have the parameter mastercheckbox pointing to its id — in other words, this master checkbox does not select all controls.

Illustration 5. Example declarations with one visible master checkbox (depending on the implementation the appearance may vary).

Last updated

Was this helpful?