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

Forms should be able to dynamically determine what URL to go to next

    Details

    • Complexity:
      Undetermined

      Description

      At present, the web application determines where to redirect to after saving a form.

      Sometimes a particular form wants to be able to determine the page you are redirected to dynamically, e.g. based on details in the form, or the patient's current status.

      (Example from Mirebalais: if you enter a Note with disposition = Death, and the patient doesn't have a death certificate, you should be redirected to the death certificate page. Otherwise, follow the standard UI flow.)

      Dev Notes

      FormEntrySession should allow you to set the page to go to after successful form submission, and this should be settable by form submission actions.

      Ideally, we'd have a tag that supports several ways of specifying things:

      // an url template, given a context including patient, encounter, mode, etc?
      <redirectOnSave url="/mirebalais/deathCertificate.form?patientId={{patient.id}}"/>
      
      // a snippet of javascript or groovy code to be executed server-side, which should return a URL, or null, for the default behavior.
      // would need to be passed various data, and probably given access to the OpenMRS context
      <redirectOnSave script="groovy">
          def dispo = encounter.allObs.find({
              it.concept.uuid == "uuid-of-disposition-concept"
          })
          if (dispo.valueCoded.uuid == "uuid-of-death")
          // etc etc
      </redirectOnSave>
      
      // implements some new interface like "NextPageDecision"
      <redirectOnSave className="org.openmrs.module.mirebalais.DecideNextPage"/>
      

        Attachments

          Activity

            People

            • Assignee:
              darius Darius Jazayeri [X] (Inactive)
              Reporter:
              darius Darius Jazayeri [X] (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: