[HTMLFormEntry] Retain form data while going to other fragments.

Hello,

We are using the HTMLFormEntry module in our project. In one of the forms we are using the allergy-fragment, where we can see and update the allergies for the patient.

Here is a screenshot of that part of the form.

We can click on update allergies and it opens the allergy fragment, where we make changes to allergies. As we can see, there might be previously filled data in the form when we go to update the allergies, which is lost when we come back to the form.

What should be the best way to solve this problem? One thought we have to update the allergies in a new tab and fetch it using a refresh button as mentioned here. (How to Use AJAX in a Fragment - Documentation - OpenMRS Wiki)

Let us know your thoughts.

CC: @mksd @mksrom @angshuonline @dkayiwa @ssmusoke @rrameshbtech @vasanth2019 @sukreet @premnisha

@mddubey I suspect that when first loading the form it should list existing allergies right?

If yes I would simply introduce a new <allergy/> tag (in the same spirit of the <condition/> tag). The tag would be used with a <repeat/> to capture a capped number of allergies within the form.

In short there would be two components in the end:

  1. A fragment to list already saved allergies.
  2. A new repeated tag to capture further allergies.
1 Like

Thanks for the response @mksd.

Are you suggesting not to open the allergyui to update new allergies and use it in the form itself?

We will give that a try, though I am not sure if we can delete existing ones since the table would be read-only.

Yes.

Again, similarly as to what was made with the <condition/> tag, it’s merely a convenience to record new conditions through a form. Managing them further would require to use the appropriate screen in the Ref App. I suggest to do the same here.

1 Like

Sure @mksd,

Thanks for the answers. We will discuss this approach and try to implement this.

Have allergies been added to the htmlform? If so, I’ll be very happy. It’s not documented in the html reference guide,

@mddubey @mksd

Not yet @ball.

In order to do so we will have to

  1. Expand the Allergy core entity to link it to a nullable Encounter and
  2. Have Allergy implement the new FormRecordable interface.

Easy stuff, especially now that there’s a recent template with Condition, but someone would have to do it and right now this is not (yet) on our roadmap.

It’s only after all the above that an actual <allergy/> HFE tag could be designed.