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.
Comment: Documented <postSubmissionAction> tag

...

Code Block
html
html
<patient field="name"/> <!-- displays the name fields -->
<patient field="identifier" identifierTypeId="2"/>  <!-- displays identifier field for identifier type 2 - input is validated accordingly  -->

<postSubmissionAction>

Lets you run server-side Java code as part of a form's submission

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"/>

<redirectOnSave>

(Since 2.4)

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}}
    • example: 

      Code Block
      <redirectOnSave url="/modules/custom/displayForPrinting.form?patientId={{patient.id}}&encounterId={{encounter.id}}"/>
  • 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

...

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 -- 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.

...

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

...

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)

...