How set a field to dropdown in Registration App Configuration

Hi @ibatista,

We could achieve this by including a <select> tag providing the values for the dropdown, see below. But beware that this would save an obs and not a person attribute, should it matter.

1) The fragment bringing in the <select>

<p>
  <label>
    ${config.label}
  </label>
  <select name="${config.formFieldName}" size="6">
    <option value ="LFHC:901">Lao</option>
    <option value ="LFHC:902">Hmong</option>
    <option value ="LFHC:905">Khmuic</option>
    <option value ="LFHC:906">Other Lao</option>
    <option value ="LFHC:911">Foreigner</option>
  </select>
  <span class="field-error"></span>
</p>

2) Its use in the app config:

"type": "obs",
"formFieldName": "obs.LFHC:912",
"label": "${project.parent.artifactId}.app.registerPatient.ethnicity",
"widget": {
  "providerName": "lfhcforms",
  "fragmentId": "field/ethnicity"
}

3) The UI result:

As you can see we used obs to do this, the registration field is of type "obs" and each of the possible answers is coded. This is the JSON configured version of a similar piece of work that we had been pointed to by @mogoodrich (thanks again) back in the days. The PIH team had done this too, but entirely in Java, see for example getCivilStatusQuestion() in their PatientRegistrationApp.java.

2 Likes