-
Notifications
You must be signed in to change notification settings - Fork 30
CheckBox Field
Benjamin Mwalimu edited this page Jul 9, 2020
·
1 revision
This is a checkbox view that is identified by type check_box
in the JSON.
Field Attribute | Usage | Required |
---|---|---|
key | Unique of the field | yes |
type | Type of the field | yes |
label | The checkbox label | no |
label_text_style | Defines the text style the checkbox label will have. Accepts the following values bold , normal , italic , bold_italic
|
no |
label_text_size | Holds the text size to be applied to the label. e.g 18sp
|
no |
label_text_color | Specifies the color the checkbox label will display. Accepts RGB color codes e.g #000000
|
no |
options | Holds the JSON array of the answers to be selected by the user | yes |
value | Holds the user entry. It's a string literal, which is the key of the selected option. Only needed in case the field has a predefined entry otherwise it's always auto-generated/automatically added through code |
no |
read_only | Holds the read-only status of a specific field. true - means the user cannot enter/type anything on the field. They can only view what is presented |
no |
editable | If set to true then the edit icon is shown on the against the label. This allows the user to edit a read_only field |
no |
exclusive | Denotes the options that cannot be selected together with other options. E.g in case you select none as an answer then all other selections are unchecked |
no |
v_required | Status to indicate whether this field is required or not | no |
relevance | Holds the rules to show/hide the specific field. This can use rules engine/ the line relevance (show in the example below) | no |
calculations | Holds the link to the rules files that has a calculation affects the field in question | no |
openmrs_entity_parent | Holds the concept id of the parent concept in OpenMRS | yes |
openmrs_entity | Holds the entity type on OpenMRS e.g Person , Address , Concept
|
yes |
openmrs_entity_id | Holds the concept id from OpenMRS | yes |
Field Attribute | Usage | Required |
---|---|---|
key | Unique of the field | yes |
text | The option label | yes |
value | Holds the selection state of the option. Its either true
|
false . Only needed in case the field has a predefined entry otherwise it's always auto-generated/automatically added through code |
openmrs_choice_id | Holds the concept id from OpenMRS | yes |
{
"key": "delivery_complications",
"openmrs_entity_parent": "",
"openmrs_entity": "concept",
"openmrs_entity_id": "161641AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"openmrs_data_type": "select one",
"type": "check_box",
"label": "Any delivery complications?",
"label_text_size": "18sp",
"label_text_color": "#FF9800",
"read_only": true,
"editable": true,
"exclusive": [
"none"
],
"options": [
{
"key": "none",
"text": "None",
"value": false,
"openmrs_choice_id": "160034AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
},
{
"key": "severe_bleeding",
"text": "Severe bleeding/Hemorrhage",
"value": false,
"openmrs_choice_id": "160034AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"text_color": "#000000"
},
{
"key": "placenta_previa",
"text": "Placenta previa",
"value": false,
"openmrs_choice_id": "160034AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"text_size": "15sp"
},
{
"key": "cord_prolapse",
"text": "Cord prolapse",
"value": false,
"openmrs_choice_id": "160034AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"text_size": "10sp"
},
{
"key": "prolonged_obstructed_labour",
"text": "Prolonged/obstructed labour",
"value": false,
"openmrs_choice_id": "160034AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
},
{
"key": "abnormal_presentation",
"text": "Abnormal presentation",
"value": false,
"openmrs_choice_id": "160034AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"text_color": "#FF9800"
},
{
"key": "perineal_tear",
"text": "Perineal tear (2, 3 or 4th degree)",
"value": false,
"openmrs_choice_id": "160034AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
},
{
"key": "Other",
"text": "Other",
"value": false,
"openmrs_choice_id": "160034AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
],
"v_required": {
"value": "false"
},
"relevance": {
"rules-engine": {
"ex-rules": {
"rules-file": "sample-relevance-rules.yml"
}
}
},
"calculation": {
"rules-engine": {
"ex-rules": {
"rules-file": "sample-calculation-rules.yml"
}
}
}
}
To make a field required add v_required
attribute with value true
. The text on the err
attribute will be displayed to the user in case the field is not filled.
"calculation": {
"rules-engine": {
"ex-rules": {
"rules-file": "sample-calculation-rules.yml"
}
}
}
The block above shows the rules engine relevance block.
"relevance": {
"rules-engine": {
"ex-rules": {
"rules-file": "sample-relevance-rules.yml"
}
}
}
The block above shows the rules engine relevance block.
Forked from Android Native JSON Form Library. Adapted in love by the OpenSRP Community . Apache License, Version 2.0
Introduction
Core Features
Form
Views