Skip to content

Time Picker field

Benjamin Mwalimu edited this page Jan 15, 2021 · 1 revision

Time Picker Field

This is a Material design date selection input field that is identified by type time_picker in the JSON.

Field attributes

Field Attribute Usage Required
key Unique of the field yes
type Type of the field yes
hint The hint/text displayed to the user no
value Holds the user entry. It's a string literal. 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
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 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 no

Example JSON

{
  "key": "user_time",
  "openmrs_entity_parent": "",
  "openmrs_entity": "",
  "openmrs_entity_id": "",
  "type": "time_picker",
  "hint": "Birth Time",
  "v_required": {
    "value": true,
    "err": "Please enter the time of birth"
  },
  "relevance": {
    "rules-engine": {
      "ex-rules": {
        "rules-file": "sample-relevance-rules.yml"
      }
    }
  },
  "calculation": {
    "rules-engine": {
      "ex-rules": {
        "rules-file": "sample-calculation-rules.yml"
      }
    }
  }
}

Required Status

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.

Rules

Calculations

  "calculation": {
    "rules-engine": {
      "ex-rules": {
        "rules-file": "sample-calculation-rules.yml"
      }
    }
  }

The block above shows the rules engine relevance block.

Relevance

"relevance": {
    "rules-engine": {
      "ex-rules": {
        "rules-file": "sample-relevance-rules.yml"
      }
    }
  }

The block above shows the rules engine relevance block.