Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack

Documentation

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • allowOverride: whether or not to allow end users to override the value
    • Default: false 
  • overrideLabel: specify a custom label for the "override" button
    • Default:  "Override"
  • tooltipTemplate: a string to display as a tooltip for reference obs; supports templated substitutions of value, encounterType, and encounterDate
    • Default:  "({{encounterType}} on {{encounterDate}})"

Related Tags

<obsFromFragment>

Used to record an observation from a given fragment. This is used when you want to use a fragment widget in an htmlform to record an Obs; this works through the associated concept which is specified by: {{conceptId}} that is used to determine the Obs' datatype as its done in 

the <obs/> tag. A number of fragments are supported by the tag, specifically the uicommons field fragments eg. datetimepicker, dropDown, checkbox, radioButtons etc. The tag can also work within or is compatible with the <obsgroup/> tag. 

Attributes

  • conceptId: ID of the associated concept
    • REQUIRED
    • Examples:
      • <obsFromFragment conceptId="2214">
      • <obsFromFragment conceptId="XYZ:HT">
      • <obsFromFragment conceptId="0cbe2ed3-cd5f-4f46-9459-26127c9265ab">
    • Value: Any valid concept integer ID, concept mapping pair, or concept uuid.
    • Default: None
  • provider: fragment provider
    • REQUIRED
    • Default: None
  • fragment: name of the fragment
    • REQUIRED
    • Default: None
  • fragmentParams: these are parameters that will be passed to or used to configure the underlying fragment
    • OPTIONAL
    • Example
      • <obsFromFragment concept="123" provider="uicommons" fragment="field/datetimepicker" fragmentParams="useTime=true"  ... />
  • initFragmentParamName: specifies the name of the parameter that holds the initial value of a given fragment
    • REQUIRED
    • Example
      • <obsFromFragment concept="123" provider="uicommons" fragment="field/datetimepicker" initFragmentName="initialValue" ... />

Related Tags

<patient>

The patient tag can be used to create a new patient or edit an existing patient within an HTML Form. The tag allows to reference age/birthdate, gender, name, address, identifier.

(Note that there is no way in the current UI to access a form without already being in the context of specific patient, so, in the current UI you can only edit, not create, a patient using this tag. In custom code, if you intend to load a form without specifying a patientId or personId as a parameter, make sure set mode=enter when calling the html form entry controller.)

  • since: 1.7.2

Attributes

  • field:
    • Example: <patient field="name" />
    • Value: see table
    • Default:

...

Lets you run server-side Java code as part of a form's submission. This action happens after standard form processing (e.g. obs are created) but it happens in the same transaction, so if this processing throws an error, the entire form submission is invalidated.

Attributes

  • class
  • required
  • value: the fully-qualified classname of a Java class that implements the interface org.openmrs.module.htmlformentry.CustomFormSubmissionAction
  • example: <postSubmissionAction class="org.openmrs.module.xyz.DecideWhereToRedirect"/>

...

Lets a form indicate what URL to go to after it is submitted, overriding the default behavior of the web framework.

Attributes

  • url: url template to redirect to
    • optional, but you must specify exactly one of url and script
    • value: an url template, that will support substitution of {{patient.id}} and {{encounter.id}}
    • Note that since the entire HTML form is XML, you may need to replace the & signs in the URL with &amp;
    • example: 

      Code Block
      <redirectOnSave url="/modules/custom/displayForPrinting.form?patientId={{patient.id}}&encounterId={{encounter.id}}"/>
      <redirectOnSave url="/module/reporting/reports/renderReport.form?reportDefinition=76cfc87a-9e88-4d39-acc7-ed68d4beb1f7&amp;patient_wanted={{patient.id}}&amp;renderingMode=org.openmrs.module.reporting.report.renderer.TextTemplateRenderer!d45c199d-c004-4ee4-aa8d-6a8061d7d9a5"/>


  • script: lets you dynamically compute an url template to redirect to
    • optional, but you must specify exactly one of url and script
    • value: the name of a ScriptEngine configured on your JVM. (Only "groovy" is officially tested, but others should work.)
    • If you specify a script attribute, then the content of the redirectOnSave tag must be the script itself.
    • Note that since the entire HTML form is XML, you will need to escape entities like &, <, and >.
    • example:

      Code Block
      <redirectOnSave script="groovy">
          import org.openmrs.api.context.Context;
          def customView = Context.getAdministrationService().getGlobalProperty("custom.view");
          return "custom.form?view=" + customView + "&amp;patientId={{patient.id}}";
      </redirectOnSave>


...

Used to add relationships for a patient. The tag allows you to replace existing relationships or add new relationships, it does not currently support editing and deleting existing relationships.

Attributes

  • type: this is the relationship_type_id (or UUID) for the relationship that should be created for the selected person.
    • REQUIRED
    • Examples
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" />
      • <relationship type="0cbe2ed3-cd5f-4f46-9459-26127c9265ab" whoAmI="A" changeExistingRelationship="true" />
    • Value: Any valid relationship type ID or UUID for a relationship type
    • Default: NONE
  • whoAmI:this is the side of the relationship the patient the form is being entered on is. For example in a Parent to Child relationship, if the form is being filled out for the child then the whoAmI value should be set to "B" whereas if the form is being filled out for the parent then the whoAmI value should be set to "A"
    • REQUIRED
    • Examples
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" />
      • <relationship type="1" whoAmI="B" changeExistingRelationship="true" />
    • Value: "A" or "B"
    • Default: NONE
  • changeExistingRelationship: this attribute determines if new relationships should be added in addition to existing relationships or should replace the existing relationships of that type. So if this value is set to true, any existing relationships of that type will be replaced. If the attribute is set to false then a new relationship will be added in addition to any existing relationships.
    • REQUIRED
    • Examples
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" />
      • <relationship type="1" whoAmI="A" changeExistingRelationship="false" />
    • Value: "true" or "false"
    • Default: NONE
  • required: this is used for validation, and if true the form will not be able to be submitted without the required relationships existing for the patient. The code checks to see if the patient already has relationships existing, so validation will not fail if the required relationship types were set up prior to entering the form (in this situation the data entry clerk can edit or add new relationships or just ignore the question). The relationship widget displays to the user all existing relationships (for the types we care about in the tag), so the data entry clerk should be able to decide if entry on this question is needed.
    • OPTIONAL
    • Examples
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" required="true" />
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" required="false" />
    • Value: "true" or "false"
    • Default: false
  • requireAttributes: this attribute restricts the search results based on person_attributes. This attribute takes in a comma separated list of attributes. Each attribute can be entered as a name value pair (separated by a ',' for example Health Center:Rwinkwavu Health Center. Alternatively the attribute value can be entered in the format of ${currentPatientAttribute("Health Center")}, in this case the relationship tag will retrieve the value of Health Center attribute for the patient of the form and use this value as the valueto match. The value for the attribute is optional, and if left out then the search will return any people that possess the specified person_attribute.  If multiple attributes are specified, only persons that match allof the specified attributes are displayed.
    • OPTIONAL
    • Examples
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" requireAttributes="Health Center:Rwinkwavu Health Center" />
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" requireAttributes="Health Center:${currentPatientAttribute("Health Center")}" />
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" requireAttributes="Health Center" />
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" requireAttributes="Health Center:Florida,Citizenship:USA" />
    • Value: any valid person attribute type and optionally the value the person attribute should have.
    • Default: NONE
  • programIds: this attribute allows the search results to be filtered based on program enrollment. So this takes in a comma separated list of the program ids (or UUIDs). This can be used in conjunction with the personAttributes if necessary. If multiple programs are specified, only patients in allof the specified programs are displayed.
    • OPTIONAL
    • Examples
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" programIds="1" />
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" programIds="1,5" />
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" programIds="0cbe2ed3-cd5f-4f46-9459-26127c9265ab" />
    • Value: Any valid program ID, program UUID or underlying concept name
    • Default: NONE
  • display: This attribute determines which widget is displayed to the user to pick the person for the relationship. A value of “search” will present the user with a popup search box, allow them to enter a search term then select from the returned list. All searches in the tag search are based on person not patient, however you can search on patient identifiers and it will work. A value of “dropDown” presents the people in a simple drop down. If the drop down list is used when a large number of people are returned then this slows down the loading of the form, so drop down box option can only be used in conjunction with the requireAttributes and/or programId fields.
    • OPTIONAL
    • Examples
      • <relationship type="1" ="1" whoAmI="A" changeExistingRelationship="true" display="search" />
      • <relationship type="1" ="1" whoAmI="A" changeExistingRelationship="true" display="dropDown" />
    • Value: "search" or "dropDown"
    • Default: search

...

Repeatedly renders code that is contained within template tags. Facilitates future code maintenance. Repeats can be nested inside of other tags. A repeat can contain only 2 top level tags: template and render.

Related Tags

<template>

  • The code contained in the <template> tags is repeated for each <render> tag.

...

A less-verbose version of the <repeat> tag.

Attributes

  • with: Defines all the item
    •     REQUIRED
    •     Value: All the items that should be rendered with tag element, defined within single quotes. Supports 1 to n sets, and 1 to n items in each set.
    •     Example:<repeat with="['664','No Complaints'],['832','Weight Loss']">

...

A user with a particular role can be restricted from either viewing a certain HTML form (or a section in the form) by using the <restrictByRole> tag.

Attributes

  • include: Defines all the user roles for whom the tag content should be included       
    •     REQUIRED (Either include or exclude field)
    •     Value: A comma seperated list of user roles
    •     Example:<restrictByRole include="System Developer,Provider"/>
    •     Default: None
    •     Since: 1.11
          

...

The <section> tag lets you break your form, and corresponding form schema, into sections. Note that we wrote this tag before HTML 5 introduced a real-HTML section tag, so the default behavior of this tag outputs a div.

Attributes

  • headerCode: Allows you specify the header label using a code that references message.properties or the translation mappings in the form itself.
    • OPTIONAL
    • Example: ???
    • Value: ????
    • Default: None.
  • headerLabel: The label to use in the section header.
    • OPTIONAL
    • Example: <section headerLabel="1. Information démographique">
    • Value: Any quoted string
    • Default: None.
  • headerStyle: Allows you to override the default style for the section header. (Treated as a CSS class.)
    • OPTIONAL
    • Value: Valid CSS class names
    • Default: sectionHeader
  • sectionStyle: Allows you to override the default style for the section. (Treated as a CSS class.)
    • OPTIONAL
    • Value: Valid CSS class names
    • Default: section
  • sectionTag: Lets you specify what tag should be used for the section
    • OPTIONAL
    • Value: Valid HTML tag name
    • Default: div
    • Since: 2.0.3
  • headerTag: Lets you specify what tag should be used for the section header
    • OPTIONAL
    • Value: Valid HTML tag name
    • Default: span
    • Since: 2.0.3

...

WARNING - In order to use this tag, you must be running openmrs platform 2.2.0 and above.

Attributes

  • required: this is used for validation, and if true the form will not be able to be submitted without the required condition otherwise the form would be submitted.
    • OPTIONAL

    • Value: "true" or "false"

    • Default: false

...

WARNING -- using this tag in a one-form per encounter workflow may cause duplicate drugOrders to be created.  See the WARNING for DrugOrder.  The same idea applies here too.

  • since: 1.9.0

Attributes

  • regimenCodes: Determines which regimens appear in the list
    • REQUIRED
    • Example: <standardRegimen regimenCodes="standardTri30,standardTri40" />
    • Value: Comma separated list of regimenCodes from the standard regimen xml in the global property 'dashboard.regimen.standardRegimens'
    • Default: None
  • discontinuedReasonConceptId: This creates a drop-down of coded reasons for discontinuing a regimen. This covers the valueCoded reason for discontinuing a regimen, and I'm currently waiting on a bug fix to 1.6+ to be able to support a text field for 'other' for discontinueReasonText.
    • OPTIONAL
    • Example: <standardRegimenregimenCodes="standardTri30,standardTri40" discontinuedReasonConceptId="1252"/>
    • Value:  a valid conceptId or uuid for the concept representing the reason for discontinuing.  This concept must have conceptAnswers.
    • Default: none

...

You need to put a submit tag at the bottom of your form, or else your users will be very disappointed in you. Label, Code, Style attributes analogous to a section tag can be applied.

Attributes

  • class: adds the specified class or classes the generated submit element in rendered HTML
    • OPTIONAL
    • Example: <submit class="input-element large"/>
    • Value: string
    • Default: None
    • Version: Available since version 2.0.9
  • submitLabel: Allows you to set the text of the submit button.
    • OPTIONAL
    • Value: Any String
    • Default: Messages from message.properties for htmlformentry.enterFormButton or htmlformentry.saveChangesButton depending on if form new form is being saved or existing form is being edited, respectively.
    • Since: 1.7.2
  • submitCode: Allows you to set the text of the submit button using an htmlformentry translation code
    • OPTIONAL
    • Value: reference to a translation code
    • Default: None
    • Since: 1.7.2
  • submitStyle: Allows you to set the style class for the submit button.  This attribute gets written into the rendered submit tag as class="<<submitStyle Value>>".
    • OPTIONAL
    • Value: Valid CSS style attributes
    • Default: submitButton CSS style is referenced by default; if none is defined in the style section, no style will be applied 
    • since: 1.7.2

...

Defines translation mappings at the top of the file which can be accessed by specialized coded attributes in other tags.

Attributes

  • defaultLocale: Allows you to specify the default variant value.
    • OPTIONAL
    • Example: <translations defaultLocale="en">
    • Value: Any quoted string.
    • Default: None.

Related Tags

<code>

Used to define a code to assign variant values to.

Attributes
  • name: Name of the variant
    • REQUIRED
    • Example: <code name="night_sweats">
    • Value: Any quoted string.
    • Default: None

...

Used to identify the value for a code as determined by the locale.

Attributes
  • locale: ????
    • REQUIRED
    • Example: <variant locale="en" value="night sweats"/>
    • Value: A valid two letter locale value. E.g. "ar", "en", "es", "fr"
    • Default: None
  • value: The value to be assigned to the code.
    • REQUIRED
    • Example: <variant locale="en" value="night sweats"/>
    • Value: Any quoted string.
    • Default: None

...

This tag is only available when using the HTML Form Entry UI Framework Integration module and OpenMRS 1.9.3+. It lets you access resources provided by the UI Framework.

Attributes

  • provider
    • REQUIRED
    • value: the name of the provider (typically the module that includes the resource you are including). 
  • javascript
    • value: name of javascript file
      • this will be relative to (provider)/omod/src/main/webapp/resources/scripts for a standard uiframework-driven module
    • includes a javascript file in the <head> of the page (and avoids duplicate imports); equivalent to <% ui.includeJavascript(...) %> in a GSP
  • css
    • value: name of css file
      • (provider)/omod/src/main/webapp/resources/styles for a standard uiframework-driven module
    • includes a css file in the <head> of the page (and avoids duplicate imports); equivalent to <% ui.includeCss(...) %> in a GSP
  • fragment
    • value: name of fragment
    • evaluates and includes a fragment inline in the html; equivalent to ${ui.includeFragment(...)} in a GSP 
  • priority
    • value: integer
    • optional (defaults to 0)
    • higher priorities will be included before other resources of the same type with a lower priority

...

An action that should be taken conditionally based on a chosen value of the <obs> it is in.

Attributes

  • value
    • REQUIRED
    • value: the obs value to trigger on. Usually this will be a concept, by id, uuid, or mapping.
  • thenDisplay
    • optional
    • value: the CSS selector of a DOM element to be shown only when the obs has the given value. If the obs has another value, this element is hidden, and any fields in it are cleared
  • thenJavascript
    • since 2.4
    • optional
    • value: an inline JavaScript snippet, called when the obs is set to the given value.
  • elseJavascript
    • since 2.4
    • optional
    • value: an inline JavaScript snippet, called when the obs is set to anything other than the given value.

...

Note: This tag is intended to be used with encounter dates that have only a date component (not a date and time component).  The tag may not always work in a logical manner when using encounter dates with a time component.

Attributes

  • workflowId:
    • REQUIRED
    • Value: id or uuid of the workflow, or concept map reference to a concept associated with a workflow
  • type
    • Value: "radio", "dropdown", "checkbox", "hidden"
    • Defaults to dropdown. Tells how to render the widget to select a state.
    • In "radio" or "dropdown" mode the widget renders a list of the states in the workflow for selection by radio or dropdown respectively.
      • If the patient is not currently in a state for that workflow, only states flagged as "initial" will appear, otherwise all states will appear
      • (States that appear can be customized by the using the stateIds & stateLabels attributes)
      • If the patient is currently in a state for that workflow, that state will be selected on form load
      • Note that selecting a blank entry from a dropdown will do nothing--it will not take the patient out of his/her current state
    • In "checkbox" mode, upon form submittal, if the checkbox is checked, the patient is transitioned into the state specified by the by "stateId" parameter
      • If the patient is currently in the state specified by "stateId", the checkbox should appear checked
      • Note that unchecking a checkbox will do nothing--it will NOT take the patient out of the state
    • In "hidden" mode, the patient is automatically transitioned into the state specified by the "stateId" parameter (assuming they aren't already in that state)

...

Table of Contents
printablefalse

Tag Reference

<code>

See <translations>

<completeProgram>

Automatically completes a PatientProgram on the encounterDate when the form is submitted. This only happens if there is a valid PatientProgram for the patient on the encounterDate. If the program has outcomes configured, then if the same concept is used on the form, that concept will be the outcome of that patient's program.

...

This is a complementary tag to the enrollInProgram tag.   Available in htmlformentry 1.7.4.

Attributes

  • programId:  ID or UUID of the program, or name of the associated concept, in which the patient is to be enrolled.
    • REQUIRED
    • Examples: 
      • <completeProgram programId="1"/> 
      • <completeProgram programId="9b45541a-e8f0-41ff-a55a-445b08a8d8b5"/> 
      • <completeProgram programId="Rehab program"/>
    • Value: Any valid program ID, program UUID or underlying concept name
    • Default: None.

...

It will be triggered when the form is first loaded, as well as when the <obs> field changes value.

Available since 2.1.6.

Attributes

None

Example Usage

Code Block
<obsgroup groupingConceptId="1">
    <p>
        Disposition:
        <obs id="whatKind" conceptId="2" answerConceptIds="3,4,5">
            <controls>
                <when value="3" thenDisplay="#admit-section"/>
                <when value="4" thenDisplay="#discharge-section"/>
            </controls>
        </obs>
    <p>
    <p id="admit-section">
        Admission diagnosis:
        <obs concept="100"/>
    </p>
    ...
</obsgroup>

...

  • since: 1.7.2
  • attributes below starting with instructionsLabel will be available in 1.7.3

Attributes

  • drugNames: Determines which drug names appear in the list
    • REQUIRED
    • Example: <drugOrder drugNames='kaletra' />
    • Value: Comma separated list of drug id, drug name, drug UUID
    • Default: None
  • validateDose: Sets whether or not to validate the dose value (min, max of the dose)
    • OPTIONAL
    • Example: <drugOrder drugNames='kaletra' validateDose='true' />
    • Value: true or false
    • Default: false
  • instructionsLabel: Renders a text box for entering instructions for the drug order.
    • OPTIONAL
    • Example: <drugOrder drugNames="d4T 30,d4T 40" validateDose="true" instructionsLabel="Drug Order Instructions: "/>
    • Value: any text label for the instructions field
    • Default:none
  • drugLabels: This allows you to change the drug names that are displayed in the drop-down drug list. There have to be an equal number of drugLabels as drugNames to use this attribute, although validation will catch this if you forget.  
    • OPTIONAL
    • Example: <drugOrder drugNames="RIF 300,RHEZ,PZA 500,NVP Susp" drugLabels="RIF,RZ, PZ, NVP Syrup" />
    • Value: a comma-delimited set of drug names.  Names will be applied to the drugs in the drugName attribute, in order.
    • Default: none
    • NOTE: Adding Drug Type Headers to the dropdown list:  Also, I added a hacky syntax to the drugName attribute what can allow you to put drug type headers in the drugName dropdown widget. To insert a drug type header into the drug list, in the drugName list, you just insert the header with the forward-slash '/' character at the beginning and end of the drugName. For example, this is a valid tag: <drugOrder drugNames="RIF 300,RHEZ,PZA 500,/Syrups/,NVP Susp" drugLabels="RIF,RZ, PZ, NVP Syrup" hideDoseAndFrequency="true"/>. You'll notice that the drugNames attribue has 5 entries and the drugLabels attribute has only four labels. This works because the /Syrups/ isn't a real drug, so it isn't considered during validation. Finally, I've added validation that doesn't allow you to select a drug type header as a drug.
  • hideDoseAndFrequency:  Allows you to hide the dose and frequency text boxes that are rendered by the tag by default
    • OPTIONAL
    • Example: <drugOrder drugNames="RIF 300,RHEZ,PZA 500,/Syrups/,NVP Susp" drugLabels="RIF,RZ, PZ, NVP Syrup"  hideDoseAndFrequency="true"/>
    • Value: true/false
    • Default: false
    • NOTE: If this tag is used the drug order will be submitted using the drug strength from the concept drug definition. 
  • checkbox: This renders a checkbox for choosing to create a drugOrder for a single drug listed in the drugName attribute. Works nicely with the "hideDoseAndFrequency" tag above.  This tag will only be applied if there is EXACTLY one drug listed in drugName, and the select attribute is set to "true".
    • OPTIONAL
    • Example: <drugOrder drugNames="Terizidone (Trd)" drugLabels="TRD" checkbox="true" hideDoseAndFrequency="true"/>
    • Value:true/false
    • Default: false
  • discontinuedReasonConceptId: This creates a drop-down of coded reasons for discontinuing a regimen. This covers the valueCoded reason for discontinuing a regimen, and I'm currently waiting on a bug fix to 1.6+ to be able to support a text field for 'other' for discontinueReasonText.
    • OPTIONAL
    • Example: <drugOrder drugNames="d4T 30,d4T 40" validateDose="true" instructionsLabel="INSTRUCTIONS:" discontinuedReasonConceptId="1252"/>
    • Value:  a valid conceptId or uuid for the concept representing the reason for discontinuing drug question.  This concept must have conceptAnswers.
    • Default: none
  • showOrderDuration: This creates a text field that allows you to say what the duration of the order should be.  This, then, is applied as an autoExpireDate.
    • OPTIONAL
    • Example <drugOrder drugNames="Nelfinavir,Tenofovir (TDF)" showOrderDuration="true" /> 
    • Value:  true/false
    • Default: false
  • defaultDose:This sets a default dose that will be pre-entered in the drug order entry widget
    • OPTIONAL
    • Example <drugOrder drugNames="Ibuprofen" defaultDose="250"/>
    • Value: empty string or a string that can be converted to a Double
    • Default: none
  • toggle: For checkbox style fields only, specify the id of a div or span that you wish to hide or disable depending on whether the checkbox is checked or not.
    • OPTIONAL
    • The toggle attribute accepts two syntaxes (see below).
      • Basic: The basic syntax simply accepts the DOM id of the target div or span:

      • Code Block
        html
        html
        <obs conceptId="12" answerConceptId="116" answerLabel="Patient has a hat" style="checkbox" toggle="hatColors"/>
        
        <div id="hatColors">
           What color is your hat?
           <obs conceptId="101" answerConceptIds="309,374,377" answerLabels="red,green,blue" style="radio"/><br/>
           <obs conceptId="103" answerConceptId="394" answerLabel="Hat is warm" style="checkbox" id="hatWarmInd"/>
        </div>


      • Advanced: The more advanced syntax accepts a JSON structure with the attributes: id and style. The "id" attribute is the DOM id of target div/span that you wish to hide or disable. The "style" attribute accepts either "hide" (default) or "dim". The "hide" style completely hides the target div/span until the checkbox is checked. The "dim" style greys-out and disables the child components of the target div/span until the checkbox is checked.

      • Code Block
        html
        html
        <obs conceptId="12" answerConceptId="116" answerLabel="Patient has a hat" style="checkbox" toggle="{id: 'hatColors', style: 'dim'}"/>
        
        <div id="hatColors">
           What color is your hat?
           <obs conceptId="101" answerConceptIds="309,374,377" answerLabels="red,green,blue" style="radio"/><br/>
           <obs conceptId="103" answerConceptId="394" answerLabel="Hat is warm" style="checkbox" id="hatWarmInd"/>
        </div>


      • Advanced:  This syntax accepts the same toggle attribute but works with repeat tags, obsgroups, and tables.

      • Code Block
                    <repeat>
                        <template>
                            <obsgroup groupingConceptId="PIH:Family planning construct">
                                <tr>
                                    <td id="{comment}-fp">
                                        <obs conceptId="CIEL:374"
                                             answerConceptId="{fpMethod}"
                                             style="checkbox"
                                             toggle="{id: '{comment}-date', style: 'dim'}"
                                        />
                                    </td>
                                    <td class="{comment}-date">
                                        <obs conceptId="CIEL:163757"/>
                                    </td>
                                    <td class="{comment}-date">
                                        <obs conceptId="CIEL:163758"/>
                                    </td>
                                </tr>
                            </obsgroup>
                        </template>
                        <render fpMethod="CIEL:780" comment="Pill"/>
                        <render fpMethod="PIH:907" comment="Depo-provera"/>
                        <render fpMethod="CIEL:5622" comment="Other"/>
                    </repeat>
        


    • Version: Available since version 1.11.0

...

Data entry widget for recording encounter date. Along with encounterLocation and encounterProvider, encounterDate should be present on every HTML form.

Attributes

  • default: Specifies default value for encounterDate widget.
    • OPTIONAL
    • Example: <encounterDate default="today"/>
    • Value: "today", "now", or ?????
    • Default: None
  • showTime: The showTime attribute determines if the encounterDate widget is date-only or date and time.
    • OPTIONAL
    • Example: <encounterDate showTime="true"/>
    • Value: "true" or "false"
    • Default: False - Widget is date-only
  • disallowMultipleEncountersOnDate: This will warn the user that this Form type has been entered for this Patient on this Encounter date.  This will prevent duplicate paper entries of the same form.  The mechanism for this is an ajax popup that is presented to the user after selecting an encounter date (only if there is already a form submitted of the same type for that date for that patient).
    • OPTIONAL
    • As of version 1.8.0
    • Example: <encounterDate disallowMultipleEncountersOnDate ="warn"/>
    • Value: "warn" or "block":  'warn' will only warn the user that they may be entering a duplicate form.  'block' will give the warning, and will then clear the encounterDate field, thus making the form un-submittable.
    • Default: there is no default.  You must choose one of the above.
  • widget: preliminary support for having different widgets (in enter/edit mode).
    • OPTIONAL
    • As of version 2.5
    • Example: <encounterDate widget="hidden"/>
    • Value: "hidden" (or no value)
      • (no value): Standard widgets (jQuery UI datepicker, optional dropdowns for hour, minute, second)
      • hidden: In enter/edit mode, there will be no visible widgets, but just <input type="hidden" .../> (one for date, and optionally 3 for hour, minute, second); This is for the advanced use case where you want to provide custom widgets that will set the values of the hidden inputs via javascript.
    • Default: none standard widgets

...

Data entry widgets bundled within the Core Apps module (and not HTML Form Entry) for recording encounter diagnoses with auto-completion. It can record multiple diagnoses marking them as presumed/confirmed and/or primary/secondary. Either of <encounterDiagnoses>  or <encounterDiagnosesByObs>  tag can be used at-most once in an HTML form.

Attributes

  • required: Specifies that the diagnoses field must be completed/filled.
    • OPTIONAL
    • Example: <encounterDiagnoses required="true"/> 
    • Value: "true", "false"
    • Default: false
  • selectedDiagnosesTarget: Specifies the id of the <div>  container where the selected diagnoses are displayed. 
    • REQUIRED
    • Example:
      <encounterDiagnoses selectedDiagnosesTarget="encounter-diagnoses-target"/> 
      <div id="encounter-diagnoses-target"></div> 
    • Value: can be any valid HTML safe id
    • Default: There is no default for this and therefore should be provided as illustrated in the above example.
  • preferredCodingSource: This is used to notify the user that choices that are presented to him through the autocomplete don't pertain to a preferred source.
    • OPTIONAL
    • As of version Core Apps 1.23.0
    • Example:
      <encounterDiagnoses preferredCodingSource="ICD-10-WHO"/> 
    • Value: A valid concept source name, e.g "ICD-10-WHO", "CIEL", "ICPC2", ... etc.
    • Default: "ICD-10-WHO"
  • diagnosisConceptClasses: Specifies one or more concept classes in a form of a comma separated string to search in. Can be used together with diagnosisConceptSources
    • OPTIONAL
    • As of version 1.23.0
    • Examples: 
      <encounterDiagnoses diagnosisConceptClasses="Diagnosis"/> 
      <encounterDiagnoses diagnosisConceptClasses="Diagnosis,Finding"/> 
    • Value: A valid concept class e.g "Diagnosis", list of classes "Diagnosis,Finding"
  • diagnosisConceptSources: Specifies one or more concept sources in a form of a comma separated string to search in. Can be used together and works well with diagnosisConceptClasses
    • OPTIONAL
    • As of version 1.23.0
    • Examples: 
      <encounterDiagnoses diagnosisConceptSources="CIEL"/> 
      <encounterDiagnoses diagnosisConceptSources="CIEL,ICPC2"/> 
      <encounterDiagnoses diagnosisConceptSources="0"/>
      NOTE: pointing to a null concept source ensures that no default will be used, it will remove the concept sources as a space for the search. 
      <encounterDiagnoses diagnosisConceptSources=""/>
      NOTE: pointing to an empty concept source will lead to using the defaults.
    • Value: A valid concept sources e.g "ICD-10-WHO", list of sources "CIEL,ICPC2" or "0" (zero)
    • Default: "ICD-10-WHO"
  • diagnosisSets: Specifies the concept sets of diagnoses to search from. Can be one or more comma separated string of UUIDs, concept mappings (e.g CIEL:160170) or combination of both representing the sets. This when provided, overrides the default globally configured set of sets of diagnoses to search from.
    • OPTIONAL
    • As of version 1.23.0
    • Examples:
      <encounterDiagnoses diagnosisSets="160170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,160169AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"/> 
      <encounterDiagnoses diagnosisSets="CIEL:160170,CIEL:160169"/> 
      <encounterDiagnoses diagnosisSets="CIEL:160170,160170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"/> 
      <encounterDiagnoses diagnosisSets="0"/> 
      NOTE: pointing to a null concept set ensures that no default will be used, it will remove the concept sets as a space for the search.
      <encounterDiagnoses diagnosisSets=""/> 
      NOTE: pointing to a empty concept set will lead to using the defaults.
    • Value: comma separated string of UUID or Concept Mappings or both or "0". When "0" (zero) is used, this means that the default globally defined concept sets are not used to search in.
    • Default: concepts contained in the sets globally defined by a set of sets concept (CIEL:160167 or 160167AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA).
    • IMPORTANT NOTE: When the diagnosisSets  is specified either through global defaults or provided in this HFE tag, the name search for diagnoses within classes and/or sources is bypassed. This means that the name search only operates within those sets, such that the classes and/or sources are ignored. To globally define diagnosis concepts sets and/or diagnosis concept sources, edit the emr.concept.diagnosisSetOfSets and emrapi.conceptSourcesForDiagnosisSearch global properties respectively.

...

Data entry widget for recording location of the encounter. Along with encounterDate and encounterProvider, encounterLocation should be present on every HTML form.

Attributes

  • default: Sets default value for the widget.
    • OPTIONAL
    • Example: <encounterLocation default="2"/>
    • Example: <encounterLocation default="SessionAttribute:emrContext.sessionLocationId"/>
    • Example: <encounterLocation default="SystemDefault"/>
    • Value: Location ID, Location UUID, Location Name. Since 1.9.5 we also support "GlobalProperty:xyz" and "UserProperty:xyz" where xyz is the name of a global property or user property, whose value must be equal to a legal location value using one of the supported formats. Since 2.0.3 we also support "SessionAttribute:xyz" where xyz is the name of an HttpSession attribute, whose value must be a location, or a String using one of the supported formats. Since 2.3 we support "SystemDefault" to set the default to the configured system default.
    • Default: None
  • order: Determines which locations appear in the list, and specifies the order in which they appear.
    • OPTIONAL
    • Example: <encounterLocation order="2,7,4"/>
    • Value: Comma separated list of Location IDs, Location UUIDs, or Location Names
    • Default: All non-retired locations in alphabetical order
  • tags: Limits the locations that appear in the list to locations tags with one or more the specified tags
    • Since 2.1.3
    • OPTIONAL
    • Example: <encounterLocation tags="Admission Location, 1" />
    • Value: Comma separated list of Location Tags IDs or Location tag Names
    • Cannot be used in conjunction with the order attribute
  • required: Defaults to true when not specified. When false the form can be submitted without specifying a location 
  • type: Specifies the input element to display (i.e a dropdown vs autocomplete); shows a dropdown by default if type is not specified
    • Since 1.11
    • OPTIONAL
    • Example: <encounterLocation type="autocomplete"/>
    • Value:  "autocomplete"
    • Default: dropdown

...

Data entry widget for recording provider for the encounter. Along with encounterDate and encounterLocation, encounterProvider should be present on every HTML form. (In 1.9+ you should use the <encounterProviderAndRole> tag instead.)

Attributes

  • default: Sets default value for the widget.
    • OPTIONAL
    • Example: <encounterProvider default="djaz"/>
    • Value: username, currentUser, Person IDs, or Person UUID
    • Default: None
  • role: Filters the list of persons to only those users with the specified role
    • OPTIONAL
    • Example: <encounterProvider role="Provider"/>
    • Value: Any valid role
    • Default: Provider
  • persons:  Determines which persons appear in the list, and specifies the order in which they appear.
    • OPTIONAL
    • As of version 1.6.8
    • Example: <encounterLocation persons="1,2,4"/>
    • Value: Comma separated list of usernames, Person IDs, or Person UUIDs

...

Data entry widget for recording one or more providers for the encounter, along with the roles those providers played in the encounter

Attributes

  • default: Sets default provider for the widget (id or uuid of a Provider, or "currentUser"). 
    • If you specify "currentUser" but the currently-logged-in user does not have a Provider record associated with their Person record, nothing happens. (If that user has more than one Provider record, one is chosen arbitrarily.)
  • count: number of potential providers for the specified role 
    • Example:  the number of dropdown widgets to render) 
    • Default is 1
  • providerWidgetSeparator:  The html that should separate each provider selection widget if count > 1
    • Default:  ", "
    • Since:  htmlformentry version 3.10.0
    • Example:  

      Code Block
      languagexml
                      <div class="provider-grid">
                          <div>
                              <encounterProviderAndRole encounterRole="98bf2792-3f0a-4388-81bb-c78b29c0df92"
                                                        providerRoles="7207ba62-027f-4f9b-be67-a9f7a8a3abcc"
                                                        autocompleteProvider="true" required="false" count="2" providerWidgetSeparator="&lt;/div&gt;&lt;div&gt;"/>
                          </div>
                      </div>


  • encounterRole:
    • When specified, this tag displays a widget for choosing a provider, and assigns it to the role indicated by this parameter. 
    • If you do not specify this attribute, then the tag will also display a widget to choose an encounter role for the provider.
    • Value:  id or uuid of an encounterRole 
  • providerRoles:  Specify the role assigned to the provider
    • OPTIONAL
    • Example:  <encounterProviderAndRole providerRoles="8" />
    • Value:  Comma separated list of provider role id or uuid
    • Requires that the Provider Management module be installed
    • since HFE 1.9 Extensions 1.2
    • providerRoles doesn't (currently) work with autocompleteProvider="true".  
      Jira
      serverOpenMRS JIRA
      serverId45c5771b-fa4b-3e43-b34a-c19dc45ccc95
      keyHTML-622

  • required: when true, the form cannot be submitted unless you have chosen a provider
  • autocompleteProvider: When true, the provider widget is rendered in autocomplete search box in which user is expected to type the few characters used to search for a particular provider (s).
    • OPTIONAL
    • When omitted it defaults to false.
    • Value: true or false
    • Example: <encounterProviderAndRole autocompleteProvider="true"/>
    • since HFE 1.9 Extensions 1.6
  • providerMatchMode: Used in conjunction with autocompleteProvider attribute to specify the position to match search text in provider identifier/names.
    • OPTIONAL
    • Values: START, END, ANYWHERE (Default is START)
    • Example: <encounterProviderAndRole autocompleteProvider="true" providerMatchMode="ANYWHERE" />
    • Since HFE 1.9 Extensions 1.6

...

Used to specify the Encounter Type while filling out an HTML Form rather than when designing the form. When using this tag, the "Encounter Type" field of the HTML Form design should be left blank.

Attributes

  • types: comma-separated list of encounterTypes to display in the select list, referenced by id, uuid, or name
  • default: the default encounterType, referenced by id, uuid or name

...

  • If state ids are specified, these patient states are set upon program enrollment
  • If the patient is already enrolled in the program when this form is submitted, the patient states are NOT automatically set; however, if the enrollment date is changed (via the logic above) all the states that have a start date equal to the enrollment date are changed to the new enrollment date
  • This tag is invalid if any of the states listed are not initial states, or if two or more of the states are from the same workflow
  • Per 
    Jira
    serverOpenMRS Issues
    serverId45c5771b-fa4b-3e43-b34a-c19dc45ccc95
    keyHTML-309
    , if the showDate parameter is not used, the encounterDate tag must appear above the enrollInProgram tag

Attributes

  • programId: ID or UUID of the program, or name of the associated concept, in which the patient is to be enrolled.
    • REQUIRED
    • Examples: 
      • <enrollInProgram programId="1"/> 
      • <enrollInProgram programId="9b45541a-e8f0-41ff-a55a-445b08a8d8b5"/> 
      • <enrollInProgram programId="Rehab program"/>
    • Value: Any valid program ID, program UUID or underlying concept name
    • Default: None
  • showDate: If true, a date widget is displayed and the patient is enrolled on the selected date; if false, or if no date selected, the patient is enrolled on the encounter date
    • OPTIONAL
    • Example: <enrollInProgram programId="1" showDate="true"/>
    • Value: true or false
    • Default: False
  • showCheckbox: If true, a checkbox widget is displayed. The patient is only enrolled if the box is checked. If the patient is already enrolled, the box is checked and disabled – it cannot be used to un-enroll a patient. Whether or not the patient is enrolled is based on the existing encounter date if there is one, else the default encounter date, else today.
    • OPTIONAL
    • Example: <enrollInProgram programId="1" showCheckbox="true"/>
    • Value: true or false
    • Default: False
    • Since version 3.9.0
  • toggle: If showCheckbox is enabled, specifies the ID of a DOM element to hide or dim when the checkbox is unticked.
    • OPTIONAL
    • showCheckbox must be "true"
    • The toggle attribute accepts two syntaxes:
      • Basic: The basic syntax simply accepts the ID of the DOM element. It hides the element when the checkbox is not ticked.

        Code Block
        html
        html
        <enrollInProgram id="ANC" showCheckbox="true" toggle="anc-form"/>
        
        <div id="anc-form">
           Favorite baby name
           <obs conceptId="101" style="textarea"/>
        </div>


      • Advanced: The more advanced syntax accepts a JSON structure with the attributes "id" and "style". The "id" attribute is the ID of the DOM element that you wish to hide or disable. The "style" attribute accepts either "hide" (default) or "dim". The "hide" style completely hides the target element until the checkbox is checked. The "dim" style greys-out and disables the child components of the target element until the checkbox is checked.

        Code Block
        html
        html
        <enrollInProgram id="ANC" showCheckbox="true" toggle="{ id: 'anc-form', style: 'dim' }"/>
        
        <div id="anc-form">
           Fetal hair color
           <obs conceptId="102" style="textarea"/>
        </div>


    • Since version 3.9.0
  • stateIds: A comma-separated list of program work flow states ids
    • OPTIONAL
    • Example: <enrollInProgram programId="1" stateIds="3, 444ce6ba-551d-11e1-8cb6-00248140a5eb, PIH:356789"/>
    • Value: Any valid program workflow state id, program workflow state uuid, or concept mapping of the underlying concept for the state
    • Default: None
    • If you reference states by concept mappings, be careful that you don't have two states in the same program with the same underlying concept, or unpredictable results will occur!

...

A tag that optionally exclude all its content based on evaluating a logic token or a velocity expression. This tag has to only contain either a logic test or a velocity test.

Attributes

  • logicTestA logic expression represents a logic test.
    • OPTIONAL
    • Example: <excludeIf logicTest="GENDER = F"/> - A logic test to see if the patient's gender is female
  • velocityTestA velocity expression represents a velocity test.
    • OPTIONAL
    • Example: <excludeIf velocityTest="$patient.gender == 'F' "/> - A velocity test to see if the patient's gender is female.

...

A tag that optionally includes all its content based on whether we are in ENTER, EDIT, or VIEW mode. (Since 2.0.3.)

Attributes

  • modein which mode to include the content
    • REQUIRED
    • allowed values: "ENTER", "EDIT", "VIEW" (not case-sensitive)
    • Example: <ifMode mode="ENTER">...</ifMode>
  • includewhether to include or exclude the content based on the mode
    • allowed values: true or false
    • default: true

...

Code Block
html
html
	<section headerLabel="2. Vaccines">
            <table class="baseline-aligned">
              <tr>
                <td style="text-align:right;">BCG</td>
                <td>
                    <immunization showDate="true" id="bcg" vaccineConceptId="886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" sequenceNumber="1" label="" />
                </td>
              </tr><tr>
                <td style="text-align:right;">POLIO 0</td>
                <td>
                    <immunization showDate="true" id="polio0" vaccineConceptId="783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" sequenceNumber="0" label="" />
                </td>
              </tr><tr>
                <td style="text-align:right;">POLIO 1</td>
                <td>
                    <immunization showDate="true" id="polio1" vaccineConceptId="CIEL:783" sequenceNumber="1" label="" />
                </td>
              </tr><tr>
                <td style="text-align:right;">POLIO 2</td>
                <td>
                    <immunization showDate="true" id="polio2" vaccineConceptId="783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" sequenceNumber="2" label=""/>
                </td>
              </tr><tr>
                <td style="text-align:right;">POLIO 3</td>
                <td>
                    <immunization showDate="true" id="polio3" vaccineConceptId="783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" sequenceNumber="3" label=""/>
                </td>
              </tr><tr>
                <td style="text-align:right;">POLIO 4</td>
                <td>
                    <immunization showDate="true" id="polio4" vaccineConceptId="783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" sequenceNumber="4" label=""/>
                </td>
               </tr>
           </table>
	</section>

<includeIf>

See <excludeIf>

<lookup>

Allows evaluation of velocity expressions. See the Velocity Users Guide for more documentation.

...

  • fn.message(String messageCode)
    • looks up the specified message code via the message source service and returns the associated localized string
    • since 2.4.0
    • Example

      Code Block
      Concept: <lookup expression="fn.message('openmrs.button.submit.label')"/>
      



  • fn.getObs(Encounter encounter, String conceptCode)

    • gets the obs for the given concept from the given encounter. (Returns an arbitrary obs if there is more than one in the encounter)
    • since 2.4
    • Example:

      Code Block
      <ifMode mode="VIEW">
          <lookup complexExpression="#set( $certificate = $fn.getObs($encounter, 'PIH: Visited provider during illness').valueCoded.equals($fn.getConcept('PIH: YES')) )"/>
          <includeIf velocityTest="$certificate">
              ...
          </includeIf>
      </ifMode>


  • fn.allObs(Encounter encounter, String conceptCode)
    • get all obs for the given concept from the given encounter
    • since 2.4
    • Example:

      Code Block
      All weight observations: <lookup expression="fn.allObs($encounter, '5089')"/>


  • fn.globalProperty(String propertyName)  and  fn.globalProperty(String propertyName, String defaultValue)
    • get the value of the global property with the given name, optionally providing a default value
    • since 2.6
    • Example:

      Code Block
      Weight Concept ID: <lookup expression="fn.globalProperty('concept.weight')"/>


  • fn.currentProgramWorkflowStatus(Integer programWorkflowId) 

    • get the state for a specified program workflow
    • Example:

      Code Block
      Outcome: <lookup expression="fn.currentProgramWorkflowStatus(16).state.concept.name" />


  • fn.location(String locationIdentifier)  
      • get the location using the specified locationIdentifier which can be a numeric locationId, uuid, name,  global property value using syntax GlobalProperty:property.name, user property with the syntax UserProperty:propName or a session attribute with the syntax  SessionAttribute:attributeName
      • since 3.4.0
      • Example: 

        Code Block
        Location: <lookup expression="fn.location(18).name" />


Attributes

  • complexExpression
    • OPTIONAL
    • Example: <lookup complexExpression="#foreach( $addr in $patient.addresses ) $!addr.cityVillage <br/> #end"/>
    • Value: Valid complex velocity expression
    • Default: None
  • class
    • OPTIONAL
    • Example: <lookup class="value" ... />
    • Value: Valid velocity class
    • Default: None
  • expression
    • OPTIONAL
    • Example: <lookup expression="patient.personName"/>
    • Value: Valid velocity expression
    • Default: None

...

As of release 2.6, macros can also be defined using xml tags (see syntax below). The added benefit added here was the ability to supply either a "value" attribute, which simply assigns a constant value to the macro, OR to supply an "expression" attribute, which enables assigning a macro value based on the evaluation of a velocity expression.  This exposes the same capabilities as the lookup tag, with the same syntax as one would use in that tag.  Examples below:

Related Tags

<macro> (from version 2.6)

Used to define a particular macro variable that can be re-used on the form.

Attributes
  • key:  The name by which the macro should be referred to in the form.  A key of "lightblue" would be referred to with the syntax "$lightblue".
    • REQUIRED
    • Example: <macro key="color" value="#e0e0ff" />
    • Value: Any quoted string.
    • Default: None
  • value:  The value to assign to the macro
    • REQUIRED if no expression attribute is present
    • Example: <macro key="color" value="#e0e0ff" />
    • Value: Any quoted string.
    • Default: None
  • expression:  A velocity expression that can be evaluated into the macro value
    • REQUIRED if no value attribute is present
    • Example: <macro key="color" expression="fn.globalProperty('mymodule.theme.color')" />
    • Value: Any valid velocity expression (see <lookup> tag for reference)
    • Default: None

...

When a form with this tag is submitted (in either Enter or Edit mode) then the patient will be marked as deceased, with a date and cause as specified by tag attributes.

Since 2.4.

Attributes

  • deathDateFromEncounter
    • if true, sets Person.deathDate to this encounter's datetime when saving the form (in Enter or Edit mode)
    • OPTIONAL
    • Example: <markPatientDead deathDateFromEncounter="true"/>
    • Value: true/false
    • Default: true
  • preserveExistingDeathDate
    • if true, and Person.deathDate is already set, then do not override it when saving the form.
    • OPTIONAL
    • Example: <markPatientDead deathDateFromEncounter="true" preserveExistingDeathDate="true"/>
    • Value true/false
    • Default: false
  • causeOfDeathFromObs
    • If specified, then submitting this form will set Person.causeOfDeath based on an obs in the saved encounter that has the specified concept.
    • If not specified, then submitting this form will set Person.causeOfDeath to Unknown (as specified by the global property concept.unknown)
    • OPTIONAL
    • Example: <markPatientDead causeOfDeathFromObs="CIEL:1543"/>
    • Value: a concept (by id, uuid, or reference)
    • Default: none

...

Note: The value of conceptId must be a complex obs with a handler, like "ImageHandler" For more info, see the Workflow section at the Complex Obs Support page.

Attributes

  • absoluteMinimum: Allows overriding the "absoluteMinimum" value of a Concept Numeric
    • OPTIONAL
    • Example: <obs conceptId="CIEL:WEIGHT" absoluteMinimum="10"/>
    • Value: String parseable as a Double
    • Default: None
    • Since: 3.9.0
  • absoluteMaximum: Allows overriding the "absoluteMaximum" value of a Concept Numeric
    • OPTIONAL
    • Example: <obs conceptId="CIEL:WEIGHT" absoluteMaximum="200"/>
    • Value: String parseable as a Double
    • Default: None
    • Since 3.9.0
  • accessionNumberLabel: Text to display before the obs.accession_number widget (which is a TextField Widget) for this obs. Specifying this implies showAccessionNumber="true".
    • OPTIONAL
    • Example: <obs conceptId="5497" labelText="Most recent CD4:" accessionNumberLabel="Accession Number:"/>
    • Value: Any quoted string
    • Default: None

...

  • toggle: For checkbox style fields only, specifies the ID of a DOM element to hide or dim when the checkbox is unticked.
    • OPTIONAL
    • The toggle attribute accepts two syntaxes:
      • Basic: The basic syntax simply accepts the ID of the DOM element. It hides the element when the checkbox is not ticked.

        Code Block
        html
        html
        <obs conceptId="12" answerConceptId="116" answerLabel="Patient has a hat" style="checkbox" toggle="hatColors"/>
        
        <div id="hatColors">
           What color is your hat?
           <obs conceptId="101" answerConceptIds="309,374,377" answerLabels="red,green,blue" style="radio"/><br/>
           <obs conceptId="103" answerConceptId="394" answerLabel="Hat is warm" style="checkbox" id="hatWarmInd"/>
        </div>


      • Advanced: The more advanced syntax accepts a JSON structure with the attributes "id" and "style". The "id" attribute is the ID of the DOM element that you wish to hide or disable. The "style" attribute accepts either "hide" (default) or "dim". The "hide" style completely hides the target element until the checkbox is checked. The "dim" style greys-out and disables the child components of the target element until the checkbox is checked.

        Code Block
        html
        html
        <obs conceptId="12" answerConceptId="116" answerLabel="Patient has a hat" style="checkbox" toggle="{id: 'hatColors', style: 'dim'}"/>
        
        <div id="hatColors">
           What color is your hat?
           <obs conceptId="101" answerConceptIds="309,374,377" answerLabels="red,green,blue" style="radio"/><br/>
           <obs conceptId="103" answerConceptId="394" answerLabel="Hat is warm" style="checkbox" id="hatWarmInd"/>
        </div>


    • Version: Available since version 1.11.0

Related Tags

<obsgroup>

Used to create an obs group. This is used when you need to link multiple <obs> concepts together. You are required to specify a groupingConceptId, which is of type ConvSet. For example, IMMUNIZATION HISTORY (1421), which has set members IMMUNIZATION SEQUENCE NUMBER (1418), VACCINE LOT NUMBER (1420), VACCINATION DATE (1410), IMMUNIZATIONS (984) and VACCINE MANUFACTURER (1419) which store the details related to the immunization. Nested obs groups are now supported.

Attributes

  • groupingConceptId: ID of the associated concept
    • REQUIRED
    • Examples:
      • <obsgroup groupingConceptId="2214">
      • <obsgroup groupingConceptId="XYZ:HT">
      • <obsgroup groupingConceptId="0cbe2ed3-cd5f-4f46-9459-26127c9265ab">
    • Value: Any valid concept integer ID, concept mapping pair, or concept uuid.
    • Default: None
  • label: an optional display label for the ObsGroup; This will not show up in the form itself, but can be used to customize column headers in data exports, for example.
    • OPTIONAL
    • Default: None
    • Example
      • <obsgroup groupingConceptId="0cbe2ed3-cd5f-4f46-9459-26127c9265ab" label="Primary Diagnosis">
  • showIfEmpty: when set to false, when viewing a form, the obsgroup tag and its contents will produce no output if the encounter you are viewing contains no matching obs group
    • OPTIONAL
    • Default: true
    • Example
      • <repeat ...> <obsgroup groupingConceptId="123" showIfEmpty="false">...</obsgroup></repeat> 

Related Tags

Example Usage

Code Block
html
html
<obsgroup groupingConceptId="1234">
    <obs conceptId="1234" answerConceptId="123" answerLabel="Other"/>
    <obs conceptId="987" labelText="specify:"/>
</obsgroup>

You can wrap an obsgroup tag anywhere in the html, generally speaking, as long as it is still a well-formed xml document.

This is okay:
    <table>
        <tr>
            <obsgroup groupingConceptId="1234">
                <td><obs conceptId="5089" labelText="Weight:"/></td>
                <td><obs conceptId="5090" labelText="Height:"/></td>
            </obsgroup>
        </tr>
    </table>

This will break:
    <obsgroup groupingConceptId="1234">
        <table>
            <tr>
                <td><obs conceptId="5089" labelText="Weight:"/></td>
                <td><obs conceptId="5090" labelText="Height:"/></td>
            </obsgroup>
        </tr>
    </table>

...

All existing Obs attributes are supported, with the following additional attributes added.

  • Since 3.9.0

Attributes

  • allowOverride: whether or not to allow end users to override the value
    • Default: false 
  • overrideLabel: specify a custom label for the "override" button
    • Default:  "Override"
  • tooltipTemplate: a string to display as a tooltip for reference obs; supports templated substitutions of value, encounterType, and encounterDate
    • Default:  "({{encounterType}} on {{encounterDate}})"

Related Tags

<patient>

The patient tag can be used to create a new patient or edit an existing patient within an HTML Form. The tag allows to reference age/birthdate, gender, name, address, identifier.

(Note that there is no way in the current UI to access a form without already being in the context of specific patient, so, in the current UI you can only edit, not create, a patient using this tag. In custom code, if you intend to load a form without specifying a patientId or personId as a parameter, make sure set mode=enter when calling the html form entry controller.)

  • since: 1.7.2

Attributes

  • field:
    • Example: <patient field="name" />
    • Value: see table
    • Default:

...

Lets you run server-side Java code as part of a form's submission. This action happens after standard form processing (e.g. obs are created) but it happens in the same transaction, so if this processing throws an error, the entire form submission is invalidated.

Attributes

  • class
  • required
  • value: the fully-qualified classname of a Java class that implements the interface org.openmrs.module.htmlformentry.CustomFormSubmissionAction
  • example: <postSubmissionAction class="org.openmrs.module.xyz.DecideWhereToRedirect"/>

...

Lets a form indicate what URL to go to after it is submitted, overriding the default behavior of the web framework.

Attributes

  • url: url template to redirect to
    • optional, but you must specify exactly one of url and script
    • value: an url template, that will support substitution of {{patient.id}} and {{encounter.id}}
    • Note that since the entire HTML form is XML, you may need to replace the & signs in the URL with &amp;
    • example: 

      Code Block
      <redirectOnSave url="/modules/custom/displayForPrinting.form?patientId={{patient.id}}&encounterId={{encounter.id}}"/>
      <redirectOnSave url="/module/reporting/reports/renderReport.form?reportDefinition=76cfc87a-9e88-4d39-acc7-ed68d4beb1f7&amp;patient_wanted={{patient.id}}&amp;renderingMode=org.openmrs.module.reporting.report.renderer.TextTemplateRenderer!d45c199d-c004-4ee4-aa8d-6a8061d7d9a5"/>


  • script: lets you dynamically compute an url template to redirect to
    • optional, but you must specify exactly one of url and script
    • value: the name of a ScriptEngine configured on your JVM. (Only "groovy" is officially tested, but others should work.)
    • If you specify a script attribute, then the content of the redirectOnSave tag must be the script itself.
    • Note that since the entire HTML form is XML, you will need to escape entities like &, <, and >.
    • example:

      Code Block
      <redirectOnSave script="groovy">
          import org.openmrs.api.context.Context;
          def customView = Context.getAdministrationService().getGlobalProperty("custom.view");
          return "custom.form?view=" + customView + "&amp;patientId={{patient.id}}";
      </redirectOnSave>


...

Used to add relationships for a patient. The tag allows you to replace existing relationships or add new relationships, it does not currently support editing and deleting existing relationships.

Attributes

  • type: this is the relationship_type_id (or UUID) for the relationship that should be created for the selected person.
    • REQUIRED
    • Examples
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" />
      • <relationship type="0cbe2ed3-cd5f-4f46-9459-26127c9265ab" whoAmI="A" changeExistingRelationship="true" />
    • Value: Any valid relationship type ID or UUID for a relationship type
    • Default: NONE
  • whoAmI:this is the side of the relationship the patient the form is being entered on is. For example in a Parent to Child relationship, if the form is being filled out for the child then the whoAmI value should be set to "B" whereas if the form is being filled out for the parent then the whoAmI value should be set to "A"
    • REQUIRED
    • Examples
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" />
      • <relationship type="1" whoAmI="B" changeExistingRelationship="true" />
    • Value: "A" or "B"
    • Default: NONE
  • changeExistingRelationship: this attribute determines if new relationships should be added in addition to existing relationships or should replace the existing relationships of that type. So if this value is set to true, any existing relationships of that type will be replaced. If the attribute is set to false then a new relationship will be added in addition to any existing relationships.
    • REQUIRED
    • Examples
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" />
      • <relationship type="1" whoAmI="A" changeExistingRelationship="false" />
    • Value: "true" or "false"
    • Default: NONE
  • required: this is used for validation, and if true the form will not be able to be submitted without the required relationships existing for the patient. The code checks to see if the patient already has relationships existing, so validation will not fail if the required relationship types were set up prior to entering the form (in this situation the data entry clerk can edit or add new relationships or just ignore the question). The relationship widget displays to the user all existing relationships (for the types we care about in the tag), so the data entry clerk should be able to decide if entry on this question is needed.
    • OPTIONAL
    • Examples
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" required="true" />
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" required="false" />
    • Value: "true" or "false"
    • Default: false
  • requireAttributes: this attribute restricts the search results based on person_attributes. This attribute takes in a comma separated list of attributes. Each attribute can be entered as a name value pair (separated by a ',' for example Health Center:Rwinkwavu Health Center. Alternatively the attribute value can be entered in the format of ${currentPatientAttribute("Health Center")}, in this case the relationship tag will retrieve the value of Health Center attribute for the patient of the form and use this value as the valueto match. The value for the attribute is optional, and if left out then the search will return any people that possess the specified person_attribute.  If multiple attributes are specified, only persons that match allof the specified attributes are displayed.
    • OPTIONAL
    • Examples
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" requireAttributes="Health Center:Rwinkwavu Health Center" />
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" requireAttributes="Health Center:${currentPatientAttribute("Health Center")}" />
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" requireAttributes="Health Center" />
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" requireAttributes="Health Center:Florida,Citizenship:USA" />
    • Value: any valid person attribute type and optionally the value the person attribute should have.
    • Default: NONE
  • programIds: this attribute allows the search results to be filtered based on program enrollment. So this takes in a comma separated list of the program ids (or UUIDs). This can be used in conjunction with the personAttributes if necessary. If multiple programs are specified, only patients in allof the specified programs are displayed.
    • OPTIONAL
    • Examples
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" programIds="1" />
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" programIds="1,5" />
      • <relationship type="1" whoAmI="A" changeExistingRelationship="true" programIds="0cbe2ed3-cd5f-4f46-9459-26127c9265ab" />
    • Value: Any valid program ID, program UUID or underlying concept name
    • Default: NONE
  • display: This attribute determines which widget is displayed to the user to pick the person for the relationship. A value of “search” will present the user with a popup search box, allow them to enter a search term then select from the returned list. All searches in the tag search are based on person not patient, however you can search on patient identifiers and it will work. A value of “dropDown” presents the people in a simple drop down. If the drop down list is used when a large number of people are returned then this slows down the loading of the form, so drop down box option can only be used in conjunction with the requireAttributes and/or programId fields.
    • OPTIONAL
    • Examples
      • <relationship type="1" ="1" whoAmI="A" changeExistingRelationship="true" display="search" />
      • <relationship type="1" ="1" whoAmI="A" changeExistingRelationship="true" display="dropDown" />
    • Value: "search" or "dropDown"
    • Default: search

...

Code Block
<relationship type="21" whoAmI="A" required="true" changeExistingRelationship="false"
	requireAttributes="HealthCenter:${currentPatientAttribute("Health Center")" programIds="3"display="search" labelText=”label” />

<render>

See <repeat>

<repeat>

Repeatedly renders code that is contained within template tags. Facilitates future code maintenance. Repeats can be nested inside of other tags. A repeat can contain only 2 top level tags: template and render.

Related Tags

<template>

  • The code contained in the <template> tags is repeated for each <render> tag.

...

A less-verbose version of the <repeat> tag.

Attributes

  • with: Defines all the item
    •     REQUIRED
    •     Value: All the items that should be rendered with tag element, defined within single quotes. Supports 1 to n sets, and 1 to n items in each set.
    •     Example:<repeat with="['664','No Complaints'],['832','Weight Loss']">

...

A user with a particular role can be restricted from either viewing a certain HTML form (or a section in the form) by using the <restrictByRole> tag.

Attributes

  • include: Defines all the user roles for whom the tag content should be included       
    •     REQUIRED (Either include or exclude field)
    •     Value: A comma seperated list of user roles
    •     Example:<restrictByRole include="System Developer,Provider"/>
    •     Default: None
    •     Since: 1.11
          

...

The <section> tag lets you break your form, and corresponding form schema, into sections. Note that we wrote this tag before HTML 5 introduced a real-HTML section tag, so the default behavior of this tag outputs a div.

Attributes

  • headerCode: Allows you specify the header label using a code that references message.properties or the translation mappings in the form itself.
    • OPTIONAL
    • Example: ???
    • Value: ????
    • Default: None.
  • headerLabel: The label to use in the section header.
    • OPTIONAL
    • Example: <section headerLabel="1. Information démographique">
    • Value: Any quoted string
    • Default: None.
  • headerStyle: Allows you to override the default style for the section header. (Treated as a CSS class.)
    • OPTIONAL
    • Value: Valid CSS class names
    • Default: sectionHeader
  • sectionStyle: Allows you to override the default style for the section. (Treated as a CSS class.)
    • OPTIONAL
    • Value: Valid CSS class names
    • Default: section
  • sectionTag: Lets you specify what tag should be used for the section
    • OPTIONAL
    • Value: Valid HTML tag name
    • Default: div
    • Since: 2.0.3
  • headerTag: Lets you specify what tag should be used for the section header
    • OPTIONAL
    • Value: Valid HTML tag name
    • Default: span
    • Since: 2.0.3

...

WARNING - In order to use this tag, you must be running openmrs platform 2.2.0 and above.

Attributes

  • required: this is used for validation, and if true the form will not be able to be submitted without the required condition otherwise the form would be submitted.
    • OPTIONAL

    • Value: "true" or "false"

    • Default: false

...

WARNING -- using this tag in a one-form per encounter workflow may cause duplicate drugOrders to be created.  See the WARNING for DrugOrder.  The same idea applies here too.

  • since: 1.9.0

Attributes

  • regimenCodes: Determines which regimens appear in the list
    • REQUIRED
    • Example: <standardRegimen regimenCodes="standardTri30,standardTri40" />
    • Value: Comma separated list of regimenCodes from the standard regimen xml in the global property 'dashboard.regimen.standardRegimens'
    • Default: None
  • discontinuedReasonConceptId: This creates a drop-down of coded reasons for discontinuing a regimen. This covers the valueCoded reason for discontinuing a regimen, and I'm currently waiting on a bug fix to 1.6+ to be able to support a text field for 'other' for discontinueReasonText.
    • OPTIONAL
    • Example: <standardRegimenregimenCodes="standardTri30,standardTri40" discontinuedReasonConceptId="1252"/>
    • Value:  a valid conceptId or uuid for the concept representing the reason for discontinuing.  This concept must have conceptAnswers.
    • Default: none

...

You need to put a submit tag at the bottom of your form, or else your users will be very disappointed in you. Label, Code, Style attributes analogous to a section tag can be applied.

Attributes

  • class: adds the specified class or classes the generated submit element in rendered HTML
    • OPTIONAL
    • Example: <submit class="input-element large"/>
    • Value: string
    • Default: None
    • Version: Available since version 2.0.9
  • submitLabel: Allows you to set the text of the submit button.
    • OPTIONAL
    • Value: Any String
    • Default: Messages from message.properties for htmlformentry.enterFormButton or htmlformentry.saveChangesButton depending on if form new form is being saved or existing form is being edited, respectively.
    • Since: 1.7.2
  • submitCode: Allows you to set the text of the submit button using an htmlformentry translation code
    • OPTIONAL
    • Value: reference to a translation code
    • Default: None
    • Since: 1.7.2
  • submitStyle: Allows you to set the style class for the submit button.  This attribute gets written into the rendered submit tag as class="<<submitStyle Value>>".
    • OPTIONAL
    • Value: Valid CSS style attributes
    • Default: submitButton CSS style is referenced by default; if none is defined in the style section, no style will be applied 
    • since: 1.7.2

...

Code Block
html
html
<htmlform>
<style>
    .customSubmit { font-weight: bold; }
</style>
<translations defaultLocale="en">
    <code name="submit_text">
        <variant locale="en" value="Close Flowsheet"/>
        <variant locale="fr" value="Not sure how to say it in French"/>
    </code>
</translations>
    ...stuff goes here...
    <submit submitStyle="customSubmit" submitCode="submit_text" />
</htmlform>

<template>

See <repeat>

<translations>

Defines translation mappings at the top of the file which can be accessed by specialized coded attributes in other tags.

Attributes

  • defaultLocale: Allows you to specify the default variant value.
    • OPTIONAL
    • Example: <translations defaultLocale="en">
    • Value: Any quoted string.
    • Default: None.

Related Tags

<code>

Used to define a code to assign variant values to.

Attributes
  • name: Name of the variant
    • REQUIRED
    • Example: <code name="night_sweats">
    • Value: Any quoted string.
    • Default: None

...

Used to identify the value for a code as determined by the locale.

Attributes
  • locale: ????
    • REQUIRED
    • Example: <variant locale="en" value="night sweats"/>
    • Value: A valid two letter locale value. E.g. "ar", "en", "es", "fr"
    • Default: None
  • value: The value to be assigned to the code.
    • REQUIRED
    • Example: <variant locale="en" value="night sweats"/>
    • Value: Any quoted string.
    • Default: None

...

This tag is only available when using the HTML Form Entry UI Framework Integration module and OpenMRS 1.9.3+. It lets you access resources provided by the UI Framework.

Attributes

  • provider
    • REQUIRED
    • value: the name of the provider (typically the module that includes the resource you are including). 
  • javascript
    • value: name of javascript file
      • this will be relative to (provider)/omod/src/main/webapp/resources/scripts for a standard uiframework-driven module
    • includes a javascript file in the <head> of the page (and avoids duplicate imports); equivalent to <% ui.includeJavascript(...) %> in a GSP
  • css
    • value: name of css file
      • (provider)/omod/src/main/webapp/resources/styles for a standard uiframework-driven module
    • includes a css file in the <head> of the page (and avoids duplicate imports); equivalent to <% ui.includeCss(...) %> in a GSP
  • fragment
    • value: name of fragment
    • evaluates and includes a fragment inline in the html; equivalent to ${ui.includeFragment(...)} in a GSP 
  • priority
    • value: integer
    • optional (defaults to 0)
    • higher priorities will be included before other resources of the same type with a lower priority

...

Code Block
<uiInclude provider="uicommons" javascript="angular.min.js"/>
<uiInclude provider="coreapps" javascript="diagnoses/diagnoses.js"/>


<variant>

See <translations>

<when>

Since: 2.1.6

Must be inside <obs id="..."><controls>...</controls></obs>. See <controls>.

An action that should be taken conditionally based on a chosen value of the <obs> it is in.

Attributes

  • value
    • REQUIRED
    • value: the obs value to trigger on. Usually this will be a concept, by id, uuid, or mapping.
  • thenDisplay
    • optional
    • value: the CSS selector of a DOM element to be shown only when the obs has the given value. If the obs has another value, this element is hidden, and any fields in it are cleared
  • thenJavascript
    • since 2.4
    • optional
    • value: an inline JavaScript snippet, called when the obs is set to the given value.
  • elseJavascript
    • since 2.4
    • optional
    • value: an inline JavaScript snippet, called when the obs is set to anything other than the given value.

...

Note: This tag is intended to be used with encounter dates that have only a date component (not a date and time component).  The tag may not always work in a logical manner when using encounter dates with a time component.

Attributes

  • workflowId:
    • REQUIRED
    • Value: id or uuid of the workflow, or concept map reference to a concept associated with a workflow
  • type
    • Value: "radio", "dropdown", "checkbox", "hidden"
    • Defaults to dropdown. Tells how to render the widget to select a state.
    • In "radio" or "dropdown" mode the widget renders a list of the states in the workflow for selection by radio or dropdown respectively.
      • If the patient is not currently in a state for that workflow, only states flagged as "initial" will appear, otherwise all states will appear
      • (States that appear can be customized by the using the stateIds & stateLabels attributes)
      • If the patient is currently in a state for that workflow, that state will be selected on form load
      • Note that selecting a blank entry from a dropdown will do nothing--it will not take the patient out of his/her current state
    • In "checkbox" mode, upon form submittal, if the checkbox is checked, the patient is transitioned into the state specified by the by "stateId" parameter
      • If the patient is currently in the state specified by "stateId", the checkbox should appear checked
      • Note that unchecking a checkbox will do nothing--it will NOT take the patient out of the state
    • In "hidden" mode, the patient is automatically transitioned into the state specified by the "stateId" parameter (assuming they aren't already in that state)

...