<html><head><title></title></head><body><div style="float: right">
Table of Contents | ||||||||
---|---|---|---|---|---|---|---|---|
|
</div>
HTML Form Entry Process Flow
...
The first step in displaying an Html HTML Form is the creation of a FormEntrySession instance, which holds, among other things:
...
...
- HtmlForm
...
- instance that holds the
...
- XML that defines the form associated with the session.
...
- HtmlFormEntryGenerator
...
- instance that provides methods to translate the HTML Form
...
- XML into HTML that can be displayed by a web browser.
...
- FormEntryContext
...
- instance that holds the context data around generating the
...
- HTML widgets.
...
- FormSubmissionController
...
- instance, initially empty, that holds the actions that need to be taken when a form is submitted.
...
- FormSubmissionActions
...
- instance, initially empty, that holds the details of what data objects need to be created or modified to commit the form to the database.
When the FormEntrySession is instantiated it first populates the FormEntryContext with any existing Patient or Encounter data associated with the form .
Next, the FormEntrySession generates the Html HTML to display using the HtmlFormEntryGenerator. It first calls the applyMacros(), applyTemplates(), and applyTranslations() methods of HtmlFormEntryGenerator to perform the substitutions required for any macros, templates (repeats), or translations defined in the form.
...
A TagHandler serves two primary purposes:
...
- It creates an instance of the appropriate*HtmlGeneratorElement* implementation and calls it's generateHtml(Context) method to generate the Html input fields to substitute for the tag. When a HtmlGeneratorElement is instantiated, it creates any widgets needed to render the element, and registers the widgets with the FormEntryContext.
- It creates an instance of the appropriate*FormSubmissionControllerAction* implementation, and adds it to the FormSubmissionController. The FormSubmissonController will use this to handle the specifics of form submissions for this element.
Note that the HtmlGeneratorElement and the FormSubmissionControllerAction may be (and, in fact, are likely to be) an instantiation of a single object that supports both interfaces. (For example EncounterDetailSubmissionElement, EnrollInProgramElement, ObsSubmissionElement, PatientDetailSubmissionElement, and PatientElement all serve as the HtmlGeneratorElement and the FormSubmissionControllerAction for their respective elements.)
All the above steps happen during the instantiation of the FormEntrySession, so, to display form, a web controller can simply instantiate a FormEntrySession-passing as parameters the patient, encounter, mode (read, enter, or edit), and the HtmlForm to use-and then use the FormEntrySession as a backing object. The field htmlToDisplay of the FormEntrySession will contain the html to display in the view.
...
That's a basic, but not exhaustive, overview of how the module work. We didn't discuss how obsgroups are implemented, or about the various classes in the schema package, among other things. Check out the javadocs for more information.
...