Uploaded image for project: 'HTML Form Entry Module'
  1. HTML Form Entry Module
  2. HTML-701

HTML Forms with Complex Obs Don't Upload/Display their files

    Details

    • Type: Bug
    • Status: Code Review (Pre-Commit)
    • Priority: TBD
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
    • Complexity:
      Undetermined

      Description

      Background

      In the Reference Application, if you use a complex Obs on an HTML Form to store an image (ImageHandler) or binary file (BinaryDataHandler), the file isn't uploaded. There is also no way to view images/files in the Reference Application UI that were uploaded through the legacy UI. When viewing the encounter contents in the Refereance Application UI it says...

      Uploaded imagejpg image
      

      However everything works properly in the legacy UI.

      How to Reproduce the error

      A. To reproduce this, you must first create a complex Obs concept. This can be done in OpenMRS 2.3.1 like this...

      1. Go to System Administration --> Advanced Administration (to get to the legacy Admin page).
      2. Click View Concept Dictionary
      3. Click Add new Concept
      4. Give it a Name like "Image"
      5. Give it a Class of "Misc"
      6. Give it a Datatype of "Complex"
      7. Give it a Handler of "ImageHandler"
      8. Save the concept. Notice the Id at the top.
        Note: For more info see the Workflow section at https://wiki.openmrs.org/display/docs/Complex+Obs+Support.

      B. Then you can add the obs to an HTML form like this...

      1. Click on Administration
      2. Click Manage HTML Forms
      3. Click New HTML Form
      4. Give it the Name "Image"
      5. Give it Version "1"
      6. Give it the Encounter Type of "Check In"
      7. Add "<obs conceptId="163099" />" to the form directly above the "<submit/>" tag. Substitute 163099 for the Id of the concept you created.
      8. Click Save.

      C. Then you can test the form by selecting a patient in the legacy UI

      1. Click "Find/Create Patient"
      2. Search for a patient; "pat" usually gives results.
      3. Click on the patient name and the legacy dashboard loads.
      4. Click the "Form Entry" tab.
      5. Click to open the "Image" form.
      6. Choose a Location.
      7. Choose a Provider.
      8. Click Choose File to browse for the image file you want to upload.
      9. Click "Enter Form".
      10. Click the "View" button beside the "Check In" encounter (Image form) you just created.
      11. Notice the preview of the image, and the button to download. It is possible to download by clicking on the link too.

      D. Then you can add this form to the Reference App, to appear on the patient dashboard...

      1. Click Home.
      2. Click Configure Metadata.
      3. Click Manage Forms.
      4. Click "Add" beside the Image form.
      5. Leave the standard settings and click "Save".

      E. Then you can test the form in the Reference Application...

      1. Click the Home button.
      2. Click Find Patient Record.
      3. Search for a patient; "pat" and choose the same patient as before.
      4. Under General Actions, click "Image".
      5. Click the arrow to edit recent visits.
      6. Find the "Check In" encounter in the list that you just entered.
      7. Click "Show Details" beside the encounter.
      8. Notice it displays an empty grey box. It should show a preview of the uploaded image.

      F. View the encounter in the legacy UI...

      1. Click "Find/Create Patient"
      2. Search for the same patient; "pat".
      3. Click on the patient name (for the same patient) and the legacy dashboard loads.
      4. Click the "Form Entry" tab.
      5. Click the "View" button beside the "Check In" encounter (Image form) you just created in the Reference Application.
      6. Notice it does not show the preview of the image, or the button to download. The image was not uploaded in the Reference Application.

      Dev Notes

      One possibile cause of this is that in the Reference Application the form is submitted via AJAX, rather than a regular form post, and thus the file upload is lost.

        Attachments

          Activity

            People

            • Assignee:
              dilantha Dilantha Silva
              Reporter:
              arbaughj James Arbaugh [X] (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 1 hour
                1d 1h