# Configuring form builder clinical forms and enable to change patient visit type from registration page.

**URL:** <https://talk.openmrs.org/t/configuring-form-builder-clinical-forms-and-enable-to-change-patient-visit-type-from-registration-page/40780>\
**Category:** Bahmni\
**Tags:** bahmni-forms\
**Created:** [October 27, 2023, 1:52pm UTC](https://talk.openmrs.org/t/configuring-form-builder-clinical-forms-and-enable-to-change-patient-visit-type-from-registration-page/40780 "2023-10-27T13:52:39Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![yohannes.suraphel](https://talk.openmrs.org/letter_avatar/yohannes.suraphel/32/5_5575768a8748004e209b776fc1b2916d.png) [@yohannes.suraphel](https://talk.openmrs.org/u/yohannes.suraphel)\
**Post date:** [October 27, 2023, 1:52pm UTC](https://talk.openmrs.org/t/configuring-form-builder-clinical-forms-and-enable-to-change-patient-visit-type-from-registration-page/40780/1 "2023-10-27T13:52:39Z")

</div>

Is there a native way to configure the following two things.

1. I’ve created a form using Bahmni implementer’s interface. And i’m able to register observations from consultation tab. But as opposed to adding a concept set to All observation template and adding `allowAddMore: true` from the default config i’m able to register multiple entry of the same from. How do i do the same for forms created using form builder?
2. After a patient has started a visit and `Start Visit Type` button changes to `Enter visit detail` button on registration page and no way to change visit type without closing the current visit. How should i configure being able to change visit?

Thanks

---

<div class="post-metadata">

**Author:** ![gsluthra](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gsluthra/32/1453_2.png) [@gsluthra](https://talk.openmrs.org/u/gsluthra)\
**Post date:** [November 3, 2023, 12:38pm UTC](https://talk.openmrs.org/t/configuring-form-builder-clinical-forms-and-enable-to-change-patient-visit-type-from-registration-page/40780/2 "2023-11-03T12:38:32Z")

</div>

**For Point2:** You want to change the VISIT TYPE without closing the current visit? I believe that isn’t possible, once a visit has been started. You will need to close that visit, and open a new one.

cc: @angshuonline @akhilmalhotra @gokul - Any idea if this is possible?

**For Point1:** I didn’t fully understand. You want to be able to fill the same form (created using FormBuilder) more than once, during the same encounter?

---

<div class="post-metadata">

**Author:** ![gokul](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gokul/32/17065_2.png) [@gokul](https://talk.openmrs.org/u/gokul)\
**Post date:** [November 3, 2023, 2:53pm UTC](https://talk.openmrs.org/t/configuring-form-builder-clinical-forms-and-enable-to-change-patient-visit-type-from-registration-page/40780/3 "2023-11-03T14:53:25Z")

</div>

Hi @gsluthra, point 2 is only possible if the user has changed the location.

- The registered user logs into Bahmni with the OPD location and starts a visit.
- Now, the user should change the location to the General Ward on the Bahmni homepage, located in the top right corner.
- If we open the same patient in the registration module, we can start a new visit while keeping the previous visit active.

However, I would like to understand the actual use case for having two visits open simultaneously so that we can provide the right solution.

---

<div class="post-metadata">

**Author:** ![akhilmalhotra](https://talk.openmrs.org/user_avatar/talk.openmrs.org/akhilmalhotra/32/20128_2.png) [@akhilmalhotra](https://talk.openmrs.org/u/akhilmalhotra)\
**Post date:** [November 6, 2023, 5:55am UTC](https://talk.openmrs.org/t/configuring-form-builder-clinical-forms-and-enable-to-change-patient-visit-type-from-registration-page/40780/4 "2023-11-06T05:55:50Z")

</div>

For this to be possible as Gokul described, there has to be more than one location tagged as ‘visit location’, which is recommended if a hospital has 2 separate buildings operating relatively independently of each other. Also, please elaborate on the use case so we can understand it better.

---

<div class="post-metadata">

**Author:** ![yohannes.suraphel](https://talk.openmrs.org/letter_avatar/yohannes.suraphel/32/5_5575768a8748004e209b776fc1b2916d.png) [@yohannes.suraphel](https://talk.openmrs.org/u/yohannes.suraphel)\
**Post date:** [November 13, 2023, 11:29am UTC](https://talk.openmrs.org/t/configuring-form-builder-clinical-forms-and-enable-to-change-patient-visit-type-from-registration-page/40780/5 "2023-11-13T11:29:06Z")

</div>

Hey @gsluthra , For point 1 for any form created using implementer’s interface its not possible to add configuration like `allowAddMore: true`. Or even make it a default observation form in `clinical/extension.json` to make it be opened by default in consultation tab

Is there another way to achieve this (Preferably without making code changes to the web)?

---

<div class="post-metadata">

**Author:** ![gsluthra](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gsluthra/32/1453_2.png) [@gsluthra](https://talk.openmrs.org/u/gsluthra)\
**Post date:** [November 13, 2023, 11:53am UTC](https://talk.openmrs.org/t/configuring-form-builder-clinical-forms-and-enable-to-change-patient-visit-type-from-registration-page/40780/6 "2023-11-13T11:53:15Z")

</div>

**PIN the form**

If you Pin the form, it should come by default as open in Consultation (Observations) tab. See this screenshot:

 ![image](https://talk.openmrs.org/uploads/default/original/3X/0/b/0b455a5e9ce1d1fe9e0cabbeb76ed932421ddc9c.png)

Once a form is pinned, this form will always show up in the left list of the Observation (Forms) tab, without having to search for it every time.

---

<div class="post-metadata">

**Author:** ![gsluthra](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gsluthra/32/1453_2.png) [@gsluthra](https://talk.openmrs.org/u/gsluthra)\
**Post date:** [November 13, 2023, 12:03pm UTC](https://talk.openmrs.org/t/configuring-form-builder-clinical-forms-and-enable-to-change-patient-visit-type-from-registration-page/40780/7 "2023-11-13T12:03:01Z")

</div>

**Add More** option for a section (group)

You can enable the “Add More” Checkbox for a section, so you can repeat the whole section again. For example see the “_Immunization Incident Record_” Form that comes out-of-the-box with Bahmni LITE (clinic-config). See in demo here: [https://demo-lite.mybahmni.in/](https://demo-lite.mybahmni.in/)

**Form in Clinical UI:**

 ![image](https://talk.openmrs.org/uploads/default/original/3X/2/1/21673bfb4ef9292b855cfcb581ebc8f162c29599.png)

**‘Add More’ Enabled in Form Builder for this Form**

 ![image](https://talk.openmrs.org/uploads/default/original/3X/d/3/d320065a5098f396f1cf9f96fba39d1a06f4432d.png)

I hope this helps.

---

<div class="post-metadata">

**Author:** ![yohannes.suraphel](https://talk.openmrs.org/letter_avatar/yohannes.suraphel/32/5_5575768a8748004e209b776fc1b2916d.png) [@yohannes.suraphel](https://talk.openmrs.org/u/yohannes.suraphel)\
**Post date:** [November 13, 2023, 3:16pm UTC](https://talk.openmrs.org/t/configuring-form-builder-clinical-forms-and-enable-to-change-patient-visit-type-from-registration-page/40780/8 "2023-11-13T15:16:01Z")

</div>

I tried that solution which worked but has a weird relationship with display control. Let’s say i have an immunization form which has display controls of its own. When i add the section once again it wont have its own display control

Example: I have an immunization dropdown which users will select an immunization type (BCG, Polio, etc) and based on that a field gets displayed where users will select number of immunizations. Every immunization type has its own doses. When a user adds that section again has different immunization type the display control `form.get('BCG Number of Immunization').setHidden(false)` will hide all fields on every section or finds the first field with that concept name and shows it.

Can i have a display control specific to a section?

Thanks

---

<div class="post-metadata">

**Author:** ![gokul](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gokul/32/17065_2.png) [@gokul](https://talk.openmrs.org/u/gokul)\
**Post date:** [November 15, 2023, 4:31am UTC](https://talk.openmrs.org/t/configuring-form-builder-clinical-forms-and-enable-to-change-patient-visit-type-from-registration-page/40780/9 "2023-11-15T04:31:27Z")

</div>

I guess I have understood the problem that you’re facing with the AddMore section along with `ControlEvents`.

When you’re working with AddMore, use `form.getFromParent` instead of `form.get`.

Please see the sample code snippet for your use case.

```auto
function(form) {
  if (form.getFromParent('immunization').getValue() === 'BCG') {
    form.getFromParent('BCG Number of Immunization').setHidden(false);
  } else {
    form.getFromParent('BCG Number of Immunization').hideAndClear();
  }
}

```

Related talk thread - [Rendering of addmore section or obsgroup is not working as expected when there are form conditions inside it - #3 by angshuonline](https://talk.openmrs.org/t/rendering-of-addmore-section-or-obsgroup-is-not-working-as-expected-when-there-are-form-conditions-inside-it/23941/3)

---

<div class="post-metadata">

**Author:** ![yohannes.suraphel](https://talk.openmrs.org/letter_avatar/yohannes.suraphel/32/5_5575768a8748004e209b776fc1b2916d.png) [@yohannes.suraphel](https://talk.openmrs.org/u/yohannes.suraphel)\
**Post date:** [November 15, 2023, 7:46am UTC](https://talk.openmrs.org/t/configuring-form-builder-clinical-forms-and-enable-to-change-patient-visit-type-from-registration-page/40780/10 "2023-11-15T07:46:13Z")

</div>

Will try it out. Just to be clear do i add this `Control Event` to the concept set section or to the immunization type dropdown?

---

<div class="post-metadata">

**Author:** ![gokul](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gokul/32/17065_2.png) [@gokul](https://talk.openmrs.org/u/gokul)\
**Post date:** [November 15, 2023, 7:59am UTC](https://talk.openmrs.org/t/configuring-form-builder-clinical-forms-and-enable-to-change-patient-visit-type-from-registration-page/40780/11 "2023-11-15T07:59:02Z")

</div>

`Immunization type` dropdown.

1. Open the ‘Form Conditions’ popup.
2. Select the immunization control from the dropdown menu located in the top right corner.
3. Write the code in Control Events box for immunization control.
4. Click ‘Save.’
5. Click ‘Preview’ and validate the form.

 ![image](https://talk.openmrs.org/uploads/default/original/3X/0/6/063f7d4dedd7a525a65d6fcc4c45b30f5e35876c.png)

---

<div class="post-metadata">

**Author:** ![yohannes.suraphel](https://talk.openmrs.org/letter_avatar/yohannes.suraphel/32/5_5575768a8748004e209b776fc1b2916d.png) [@yohannes.suraphel](https://talk.openmrs.org/u/yohannes.suraphel)\
**Post date:** [November 15, 2023, 8:08am UTC](https://talk.openmrs.org/t/configuring-form-builder-clinical-forms-and-enable-to-change-patient-visit-type-from-registration-page/40780/12 "2023-11-15T08:08:15Z")

</div>

Alright. Thanks!
