The HTML Form Entry UI module provides integration between HTML Form Entry and the UI Framework, allowing forms to be rendered in with the OpenMRS 2.0 style.
Unfortunately, this functionality have been woefully under-documented, but I hope to add some documentation here.
Serving Up Forms as Resources
In the initial design of OpenMRS 1.0 and HTML Form Entry, HTML Forms were stored in the database and edited via a simplistic editor built-in to the OpenMRS 1.0 administrative interface.
Storing forms directly in the DB made it almost impossible to collaborate on them and to maintain a version control system.
In OpenMRS 2.0, forms can be bundled up in custom modules, or even stored in the application data directory, and served up by the UI Framework as a resource. It's important to note that the form is still stored behind-the-scenes in the database, but forms referenced by resource will be loaded from the file system on demand and them updated in the DB before being rendered to the user. This allows developers to "hot reload" forms when working on them.
Serving Up a Form from the File System
Let's say you have a form "myForm.xml" that you'd like to load directly from the file system. The first step it to put the form in the "configuration" directory (or one of it's subdirectories) found within the application data directory.
For instance, in a type Tomcat instance on Ubuntu this might be as follows:
Then, you can reference this form by setting up an app or extension that renders the following link:
HFE-UI provides basic support for maintaining multiple versions of a single form and loading the correct version of the form based on the version used to create the initial encounter.
To do this, forms should be named in the format myForm_v[versionNumber].xml, where version number matches the version number defined in the form schema.
For instance, say you have three versions of "myForm", versions 1.0, 2.0, and 3.0, where 3.0 is the "current" version of the form. You could name them like this:
formName="My Form V1.0" formVersion="1.0">
formName="M Form V2.0" formVersion="2.0">
formName="My Form V3.0" formVersion="3.0">
Then if you load a form via "file:pih/htmlforms/myForm.xml" and there's a encounter within the context, HFE will look to see if the encounter has a certain form version associated with it, and then will look for a file appended with that version. If no matching file is found, the default filename, "myform.xml", will be used.
Note that we call the most recent version of the form just "myform.xml" because that is the default version we want served up if no encounter is present (ie when creating a new form).
In the future, for example, if you were going to create a new "4.0" version of the form, you'd rename myform.xml → myform_v.3.0.xml and create a new myform.xml (setting a new random formUuid) with the new version 4.0 of the form.