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

Tags: #<Tag:0x00007f302b9c8e18> #<Tag:0x00007f302b9c8c38> #<Tag:0x00007f302b9c8af8> #<Tag:0x00007f302b9c8a30>

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. (https://wiki.openmrs.org/display/docs/How+to+Use+AJAX+in+a+Fragment)

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.