Update of HTML Form in completed Visit within Ref App UI

I have a couple of forms built with HTML Form Entry which are entered at different times during the patient lifecycle. In the legacy UI this was done by editing the forms, but I am unable to do so in the new UI - probably because the visit has ended. The previously entered data is not loaded in the ref app UI yet it is displayed in the legacy UI

I cannot have two instances of the form as the data entered cannot be duplicated, and neither can I break the from into smaller components as it has to match the paper version.

A link to the form is https://gist.github.com/ssmusoke/b2e6e9aa642b0970565b

Can you clarify this? I know that the refapp UI does not display encounters that don’t belong to any visit. Is that the situation, or something else?

If you have a couple of HTML Forms that are really once-per-patient forms rather than once-per-visit, you could write some custom code (either a widget or an extension) to display these in a special way on the patient summary, with an appropriate Enter/Edit link.

@darius I cleaned up the data so that every encounter is based on a visit, by generating the visit dates and data from the encounter.

Please can you point me in the direction of a widget or extension for an example of of how to approach once per patient forms?

Thanks in advance

@arbaughj’s has a nice example of how to do this purely via javascript in the form here: https://wiki.openmrs.org/display/docs/HTML+Form+Entry+JavaScript+Reference?focusedCommentId=76677882#comment-76677882

You could either do this, or else achieve what I presume is better UX by highlighting these with their own special section or link on the patient summary.

An example of a module that attached a section to the patient summary is the Allergy UI module. See the fragment controller, fragment view, and extension defintion.

To do once-per-patient forms, in the controller you would test the patient’s encounters to see if they have an existing one already (by EncounterType or by Form, as you prefer) and if they do you can show them a link to edit it, or if not, a link to create it.

Alternately, if you just want a special link, create a “general actions” extension that goes to a new page you create like “fillOutXyzForm.page” whose controller just does a redirect to either the edit or enter URL in htmlformentryui.

@ssmusoke, this seems like a pretty common use case that people have, so it would be great if once you’ve decided how to approach this, you add some documentation on the wiki for the next person, with a few code snippets.

@darius thanks for the advice, I will document for others to leverage.