-
Notifications
You must be signed in to change notification settings - Fork 30
Spinner Field
Benjamin Mwalimu edited this page Jul 20, 2020
·
3 revisions
This is an android spinner field view that is identified by type spinner
in the JSON.
Field Attribute | Usage | Required |
---|---|---|
key | Unique of the field | yes |
type | Type of the field | yes |
hint | The Spinner label | no |
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 |
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_data_type | Holds the openmrs datatype e.g select one
|
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 |
---|---|---|
values | Hold the items to be displayed on the spinner dropdown. This is a JSON array of strings
|
yes |
openmrs_choice_ids | Has a JSON array that holds a key value pair of key:openmrs_concept e.g Health facility:"1588AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
yes |
{
"key": "Place_Birth",
"openmrs_entity_parent": "",
"openmrs_entity": "concept",
"openmrs_entity_id": "1572AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"openmrs_data_type": "select one",
"type": "spinner",
"hint": "Place of birth *",
"label_info_title": "Place of birth spinner",
"label_info_text": "here is some text on this dialog",
"values": [
"Health facility",
"Home"
],
"openmrs_choice_ids": {
"Health facility": "1588AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"Home": "1536AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
},
"value": "Home",
"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"
}
}
}
}
Field Attribute | Usage | Required |
---|---|---|
options | Holds the JSON array of the answers to be selected by the user | yes |
Field Attribute | Usage | Required |
---|---|---|
key | Unique of the field | yes |
text | The option label | 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 |
{
"key": "delivery_complications",
"openmrs_entity_parent": "",
"openmrs_entity": "concept",
"openmrs_entity_id": "161641AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"openmrs_data_type": "select one",
"type": "spinner",
"hint": "Any delivery complications?",
"read_only": true,
"editable": true,
"options": [
{
"key": "none",
"text": "None",
"openmrs_entity": "",
"openmrs_entity_id": ""
},
{
"key": "severe_bleeding",
"text": "Severe bleeding/Hemorrhage",
"openmrs_entity": "",
"openmrs_entity_id": ""
}
],
"value":"severe_bleeding",
"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