sc-check-list
Updated pdexter 2024-07-02
This document is a user guide for the sc-check-list component version 5.13, released May 21, 2019.
1 Purpose
sc-check-list places a check list field on a form, allowing the user to select one or more values from a list.
The sc-check-list definition provides fields for setting the properties of a checklist field and is fully described below.
2 Definition
sc-check-list is defined by a set of name/value pair fields consisting of:
- Required system fields
- Required customizable fields
- Optional customizable fields
Note:
- Default values for fields described in the tables below are shown in bold text.
2.1 Required System Fields
Field | Valid Values | Description |
---|---|---|
componentName | sc-check-list | The component name. Example: "componentName": "sc-check-list" |
2.2 Required Customizable Fields
Field | Valid Values | Description |
---|---|---|
name | Any value written in camel case. | Defines the name of the field in the document and database. Example: "name": "testScCheckList" |
list | Any value(s) | An array of one or more values Example: list": [ "Father", "Mother", "Son", "Daughter", "Brother" ,"Sister" ] |
2.3 Optional Customizable Fields
Field | Valid Values | Description |
---|---|---|
defaultValue | Array of one or more of the listed values. | The check list field displays with the default value(s) ticked. Example: "defaultValue": [Mother"] |
Defaults to no values ticked. | ||
disableSave | true | Changing the sc-check-list field value (i.e. ticking or unticking a check box) does not trigger the Save icon to flash. Exiting the form without saving changes to the sc-check-list field value does not trigger a warning message to display. In the Angular version of the sc-check-list component, clicking the Save icon will not save the sc-check-list field value to the document. In the AngularJS version of the sc-check-list component, clicking the Save icon will save the sc-check-list field value to the document. Example: "disableSave": true |
false | Default value. Changing the sc-check-list field value (i.e. ticking or unticking a check box) does trigger the Save icon to flash. Exiting the form without saving changes to the sc-check-list field value does not trigger a warning message to display. In both the Angular and AngularJS versions of the sc-check-list component, clicking the Save icon will not save the sc-check-list field value to the document. |
|
enabled | false | The check list field is greyed out. A Stop icon appears on mouseover. The check list field cannot be ticked. Example: "enabled": false |
true | Default value. The check list field is not greyed out. A Stop icon does not appear on mouseover. The check list field can be ticked. |
|
fullWidth | true | The Check List field displays full width on the form. Example: "fullWidth": true |
false | Default value. The Check List field does not display full width on the form. |
|
label | Any value | Defines the name of the field on the form i.e. the field label. Example: "label": "Test sc-check-list" |
Defaults to the check list field displays without a field label on the form. | ||
mandatory | true | The Check List field displays as mandatory (i.e. label in red text with an asterisk). Saving without a value, a message prompts the user to enter a value for the Check List field . Example: mandatory": true |
false | Default value. The Check List field displays as optional (i.e. label in black text). Saving without a value, a message does not prompt the user to enter a value for Check List field . |
|
visible | false | The Check List field is not visible on the form. Example: "visible": false |
true | Default value. The Check List field is visible on the form. |
3 Typical Definition
Below is a typical sc-check-list definition, defined with its required fields plus any optional field whose value is typically other than its default value.
{
"componentName": "sc-check-list",
"name": "testScCheckList",
"label": "Test sc-check-list",
"list": [
"Father",
"Mother",
"Son",
"Daughter",
"Brother",
"Sister"
]
}
One or more of the optional fields shown below can be included in the above definition should a value other than their default value be required.
"mandatory": true,
"defaultValue": ["Mother","Daughter"],
"disableSave":true,
"enabled":false,
"fullWidth":true,
"visible":false,
4 Examples
Example 1
sc-check-box defined with the typically needed fields plus the "mandatory" and "fullWidth" fields.
{
"componentName": "sc-check-list",
"name": "testScCheckList",
"label": "Test sc-check-list",
"list": [
"Father",
"Mother",
"Son",
"Daughter",
"Brother",
"Sister"
],
"mandatory": true,
"fullWidth": true
}
Resulting field on the form:
Resulting field on the form after ticking the check list field:
Resulting field in document and database after saving the ticked check list:
"testScCheckList": [
"Mother",
"Daughter",
"Sister"
]
Field value in rulesets
When the field has all values deselected, the value of the field is not []
(empty array) but ""
(empty string).
A correction to this at this stage may cause unpredictable bugs in existing code.
Therefore it is necessary to have any code dealing with the value of a checklist be capable of dealing with empty string rather than empty array as a possible value.