XForms Module Properties Tab

Shows properties for the selected item (page, question, or question option) in the Forms Pane.

Text

This is the display text of the item.

Help Text

The text which explains more than what the text property does. For browser data entry, this will be displayed as a tooltip for the question widget.

Data Type

The type of data to be collected for the selected question.
The supported data types are:

Text

Use this for free text entry.

Number

Numbers without decimal points.

Decimal

Numbers with decimal points.

Date

Dates.

Time

Time.

Date Time

Date and time.

Boolean

True and False or Yes and No.

Single Select

A list of items where only one item can be selected at a time.

Multiple Select

A list of items where more than one item can be selected at the same time.

Repeat

One or more questions which can be repeated an arbitrary number of times. An example of this are problems lists.

Picture

Picture taking or file upload.

Video

Video capture or file upload.

Audio

Sound capture or file upload.

Single Select Dynamic

A list of items to select one at a time, but where the list varies according to the selected value in another question. An example of this could be country selection list which changes according to the selected continent.

GPS

GPS cordinates. eg Latidute, Longitude and Altitude.

Binding

The internal identifier of the item. This is disabled and hence you will not edit it.

Visible

Determines if a question will be shown. For instance the database patientId, though part of the form, may be hidden from the user because it is the application which supplies a value for the current patient.

Enabled

Determines if the question answer can be edited. When using Mozilla Firefox, the value for a disabled widget is not displayed. If you want to see the value but without changing it, and you are using Firefox, then you may leave the question enabled and tick the locked property.

Locked

Determines if the question answer can be edited. This disables question answer editing but also displays the value for Firefox.

Required

Determines if an answer should be supplied for the question before the form can be submitted for saving.

Default Value

The answer taken when the one filling the form has not supplied any. For Single Select/Multiple Select fields, the "Default Value" should be the "Binding" value of the default concept. Here is one example of the "Binding" for an OpenMRS system which assumes the use of the MVP-CIEL concept dictionary: For a Single Select field which has the options "NORMAL" and "ABNORMAL", where "NORMAL" should be the default value, set the field's "Default Value" to "1115^NORMAL^99DCT".

Calculation

This is only for those fields whose values are a result of some computation. For instance if we had three fields: Weight1, Weight2, Weight3.
Where Weight3 = Weight2 - Weight1.
Then the calculation property would be only for the Weight3 field and would be: /form/obs/weight2/value - /form/obs/weight1/value
You can use the "add field" link on the right hand side which lets you select a form field and it inserts the xpath expression for each field.

Another example to multiple or divide is the following (/form/obs/peso_kg/value * 10000) / (/form/obs/talla/value * /form/obs/talla/value)

Use of conditionals

Let's say you want to set Weight3 to 10 only when Weight2==10, else Weight3=0;

For conditionals such as this, a form would be (/form/obs/weight2/value)==10?10:0

The "short if" works like this: condition?value_true:value_false.

Another example is all of this in the calculate property (where weight 2-4 are numeric concepts)

(function () { if(/form/obs/weight2/value == 6101 || (/form/obs/weight3/value == 6101 && /form/obs/weight4/value == 6101) ) { return 4; } else if (/form/obs/weight2/value == 6102 || /form/obs/weight3/value == 6102) { return 2; } } ) ()

If the field you are comparing with is a single or multiple select (for example if the question is a coded concept), then change 6101 to '6101^NAME^99DCT'

For max, set the calculation property to something like: Math.max(/new_form1/question1/value, /new_form1/question2/value)

For min, set the calculation property to something like: Math.min(/new_form1/question1/value, /new_form1/question2/value)

For sum, set the calculation property to something like: /new_form1/question1/value + /new_form1/question2/value

NOTES:

  1. There is a bug which requires you to have spaces on both sides of the equal signs. For instance, use: ...value == 6101 instead of ...value==6101. This also applies to the values above, where the /form/question1/value must have a space with the previous coma.  So Math.max(/new_form1/question1/value,/new_form1/question2/value) will not work (no space between , and /new_form1/question2. but Math.max(/new_form1/question1/value, /new_form1/question2/value) will. 

  2. All of the /form/question/value can be added by clicking on the Add Field link at the right of the calculate box and selecting the concept.

Description Template

A combination of any question answers and text which can be used to describe data collected in a form. This is mostly used for mobile devices which can have a list of data collected for the same form and use the property to enable the user to differentiate between the data items without having to first open and check each one by one. This is a property of only the form item and therefore you can give it a value only when the form is selected under the Forms Pane. If you do not know the syntax used, you can click the "Add Field" link and type the name of the question you would like to be part of the form description template.

An example of a description template for the basic form is "${/form/patient/patient.family_name}$ in ${/form/encounter/encounter.location_id}$". If for instance the answer for the family_name question is "Daniel" and the one for location is "Masaka Hospital", then at runtime the form description template will be "Daniel in Masaka Hospital"

Skip Logic

This enables you create rules governing which questions are to be valid basing on answers from some other questions. An example would be a pregnancy question which is not valid when gender is male. XForms Module Skip Logic

Validation Logic

This is used to create rules that determine the range of values valid as answers for a question. An example could be setting weight to be between 0 and 250, Last name should not be more than 20 characters, Encounter date should not be after today, and more. XForms Module Validation Logic

Dynamic Lists

This is used to select the list of items which are valid for a Single Select Dynamic question type basing on a particular selected answer in another question. XForms Module Dynamic Lists

Resources