Uploading files using HTML formentry

Hi @mogoodrich,

@akshika47 is working on trying to build a form that allows you to upload files using HTML form entry (for the OpenMRS 2.0 UI) I see that this is something that has been completed - at least according to this page: https://wiki.openmrs.org/pages/viewpage.action?pageId=36668565

The ticket details work performed under HTML-314, and appears to be complete. Ummm… could you share with us some examples of a form that uses this feature? I’m afraid that I cant seen to find any examples in the form bank - and our attempts to mimic the wiki page instructions fail silently :frowning:

Unfortunately, I don’t have any examples of using that feature (though come to think of it, I may have a use case for it in the near future!)

I tested it when Wesley issued the pull request, but of course that was 2 years ago, so there certainly could have been a regression. Not sure if anyone is using it–anyone else out there able to weigh in?

Take care, Mark

@surangak @mogoodrich Do you have any suggestion to get this feature working? :frowning:

Unfortunately, no specific ideas. I would to check to see if there is any specific unit test coverage of the the issue, and if you could expand that.

But probably the best thing to do is to to when you are testing uploading a form and it is “failing silently” to put some breakpoints in the relevant handlers and see if you can figure out what is going on.


Hi @akshika47 and @surangak

My suggestion is a bit of out of line, but I want to mention it, just in case it fits. You could try using our new Visit Documents UI module (VDUI) to achieve your goal. In which case, use the dev branch for now and keep in mind that you are using a beta.

We want to properly release a first beta version soon and introduce the module to the Community. But as I am currently on holidays everything is a bit delayed since I won’t be able to provide proper follow up for the next few weeks.

VDUI will record obs, which I think is what you are after with the HFE form, but it won’t allow you to attach it to a specific encounter. When using VDUI to upload documents then an ad-hoc encounter type is used. It really depends on your constraints & requirements whether this is a blocker.

Please checkout the latest README to know more. Any feedback would be much appreciated.

Good luck!

1 Like


Thank you for the reply. Is there a way for me to connect this to an existing OpenMRS HTML form?

I believe that you could set the ‘upload’ encounter type UUID to the one of your form, but there would be caveats. In that case, with the ‘unique’ encounter flow type set, each uploaded document would attach to that form. But then this setup would expect that there is only one such form per visit, that is one caveat I can think of.

Since VDUI aims at being a ‘complex obs management UI’ rather than using the above ‘hack’, it is more realistic to extend its features so that it provides the ability to assign an uploaded document to a specific encounter within the visit. This is just an idea, and this is not yet implemented (or even on the roadmap).

As of its version 1 it provides two main features:

  1. It provides a place to upload any document.
  2. It provides a place to view/render any complex obs saved through itself or ‘elsewhere’ (so through an HFE form for example).

If it is essential that your uploaded documents are recorded as obs on a given form, then it will be tricky to achieve this with VDUI v1.

@mksd thanks for posting this! This module may be quite interesting to us. We are currently running OpenMRS 1.10.4. Do you know what the limitations are in the module that makes it require 1.11.4?

Thanks, Mark

Hi @mogoodrich,

I did set 1.11.4 as the minimum version because this module was developed against Ref App 2.3. But in fact it could very well work with earlier versions of the Core. From the top of my head, the main assets that are needed are the Core file handlers, and they seem to be there already on 1.10.x: https://github.com/openmrs/openmrs-core/tree/1.10.x/api/src/main/java/org/openmrs/obs/handler

Great! We would be more than happy to have more tester/users/devs and to keep bringing new features to this module. Please try it out and let us know your thoughts. We have ideas about new features and we would be very curious to get feedback from the Community.

Cheers. D

Great! I will try downgrading the required version to 1.10.4 and see if it fires up for me. Hopefully will get some time to test it out this week, will keep you posted.


Sounds good, looking forward to receiving your feedback.