Overview

The HTML Widgets module provides a set of reusable HTML form field widgets in order encapsulate the common input requirements for OpenMRS. This is an "under the hood" module, meant to be something that developers can utilize in their code. The intention is to provide a compelling alternative to FieldGen, with the following key distinctions:

Download

Usage

The htmlwidgets module ships with a single web page which aims to both demonstrate and test each of the default Widgets. Once you have installed the module, you can access this page on your local server at :

http://your.Server.Name/openmrs/module/htmlwidgets/demonstration.form

Currently, the most common way of using the widgets is via the supplied tag library. However, they can also be instantiated and rendered programmatically. Below will show the most common use cases via tag library...

1. First, you need to import the tag library into your JSP like this:

<%@ taglib prefix="wgt" uri="/WEB-INF/view/module/htmlwidgets/resources/htmlwidgets.tld" %>

2. Now, you can add form fields in the following ways:

<wgt:widget id="encounterLocation" name="encounterLocation" object="${encounter}" property="location"/>

This will create a select list allowing the user to pick a Location, populated by default with the current value of the encounter's Location

<wgt:widget id="encounterLocation" name="encounterLocation" object="${encounter}" property="location" format="ajax"/>
<wgt:widget id="conceptSearch" name="concept" type="org.openmrs.Concept"/>

Widget Reference

TBD