Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updates checkbox
Table of Contents
minLevel1
maxLevel6
outlinefalse
stylenone
typelist
printabletrue

Field Types

RFE has The OpenMRS Form Engine leverages what has sometimes been called “The React Form Engine (RFE)”. This project committed to the schema used by the previous Angular Forms-based Form Engine, and as such, there is a high level of compatibility. RFE The OpenMRS Form Engine supports almost all the field types from the JSON schema with a few extensions. The most commonly used fields include text, textarea, number, date and select.

...

Code Block
languagejsx
{
  "label": "Order date",
  "type": "obs",
  "questionOptions": {
    "rendering": "datetime",
    "concept": "162078AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
    "weeksList": "",
    "conceptMappings": [
      {
        "type": "CIEL",
        "value": "162078"
      }
    ]
  },
  "id": "orderDate"
}

Renders:

...

image-20240418-155718.pngImage Added

checkbox

Renders like a multi-choice select field. This kind of field lets you select more that one option.

Code Block
languagejsx
{
  "label":"Is the client experiencing any of the following TB symptoms?",
  "type":"obs",
  "questionOptions":{
    "rendering":"checkbox",
    "concept":"159800AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
    "answers":[
      {
        "concept":"1494AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
        "label":"Fever lasting more than 3 weeks"
      },
      {
        "concept":"159799AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
        "label":"Cough lasting more than 2 weeks"
      },
      {
        "concept":"138905AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
        "label":"Hemoptysis"
      },
      {
        "concept":"133027AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
        "label":"Night sweats"
      }
    ]
  },
  "id":"tbSymptoms"
}

Renders:

...

You also have an option to display all the answers inline that will render all answers for easier selection by including the "inlineMultiCheckbox": true at the question level

Code Block
{
  "label":"Inline MultiCheckbox Question",
  "type":"obs",
  "inlineMultiCheckbox": true,
  "questionOptions":{
    "conceptrendering":"133027AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcheckbox",
        "labelconcept":"Night sweats159800AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
      }
    "answers":[...]
  },
  "id":"tbSymptomsmulticheckboxQn"
}

RendersDemo:

...

textarea

Renders a textarea input. By default, the textarea will be 4 rows tall. You can configure the number of visible text lines for the input by providing a number to the rows property in your questionOptions definition.

...

Think of this as a hidden HTML input. In some cases, a form needs to a persist a predefined non-mutable value on submission.

...

Code Block
languagejsx
{
  "label": "Location where it occurred (ui-select-extended illustration)",
  "type": "obs",
  "required": false,
  "id": "ui-select-extended-location-illustration",
  "questionOptions": {
    "rendering": "ui-select-extended",
    "datasource": {
      "name": "location_datasource",
      "config": {
        "tag": "e065fcd0-f3a5-432e-8fd6-33d24864d64f"
      }
    },
    "concept": "161011AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
  }
}

Renders:

...

image-20240418-160319.pngImage Added

Under datasource, you pass the datasource name and optionally you can pass a config parameter. For the case of location, in the config, we pass the tag.

...

Code Block
languagejson
{
  "label": "Select a drug",
  "type": "obs",
  "questionOptions": {
    "rendering": "drug",
    "concept": "8d490dfc-c2cc-11de-8d13-0010c6dffd0f"
  },
  "id": "drug_select"
},

rendersRenders:

...

...