Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

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

Documentation

Skip to end of metadata
Go to start of metadata
Contents

Overview

OpenMRS provides Form, Field and FormField objects through the API as well as schema creation in the webapp. FormEntry Module, HTML Form Entry Module and XForms Module all utilize the built-in Form infrastructure. OpenMRS also provides API calls to store serializable resources or metadata on any given Form instance.

Forms

Fields

Form Fields

Schemas

Form Resources

Terms To Understand

Overview

FormResource objects can be of any Custom Datatype. Only one FormResource will be stored for any combination of Form object and name (property on the FormResource). In other words, there can only be one formentry.xslt FormResource for any given Form. If FormService.saveFormResource() is asked to save a new formentry.xslt FormResource on a Form that already has a formentry.xslt FormResource, the FormResource already stored in the database will be purged before saving the new one.

A FormResource is both a CustomValueDescriptor and a SingleCustomValue. This means that any given FormResource not only holds data but also specifies the kind of data in it, similar to how GlobalProperty objects work in OpenMRS 1.9+. Form edit pages provide a tab to manage FormResource objects on that Form.

TODO: screenshot(s) of Form Resource management

Designing Form Resources

Working with FormResource objects should follow the same methodology as working with GlobalProperty objects. Following is a unit test from FormServiceTest to show how this is done, using a basic DateDatatype:

API Methods

The OpenMRS FormService API must be used to manipulate FormResources. The following API calls are available from org.openmrs.api.FormService:

Common API retrieval methods for FormResources.


Saves a FormResource. The name property of the FormResource must be unique and should refer to a particular service or module claiming ownership of the resource and the use of that resource. Only one resource for each <i>name</i> will ever be saved on a given Form.


Saves a FormResource. The name property of the FormResource must be unique and should refer to a particular service or module claiming ownership of the resource and the use of that resource. Only one resource for each name will ever be saved on a given Form.


Permanently removes a FormResource.


Retrieves all FormResources for a given form.


Retrieves all unique owners for resources for a given form.

  • No labels