# Support for mandatory fields in CSV upload for Encounters in Forms2

**URL:** <https://talk.openmrs.org/t/support-for-mandatory-fields-in-csv-upload-for-encounters-in-forms2/32077>\
**Category:** Bahmni\
**Tags:** import, csv\
**Created:** [February 8, 2021, 10:55am UTC](https://talk.openmrs.org/t/support-for-mandatory-fields-in-csv-upload-for-encounters-in-forms2/32077 "2021-02-08T10:55:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sivareddy](https://talk.openmrs.org/letter_avatar/sivareddy/32/5_5575768a8748004e209b776fc1b2916d.png) [@sivareddy](https://talk.openmrs.org/u/sivareddy)\
**Post date:** [February 8, 2021, 10:56am UTC](https://talk.openmrs.org/t/support-for-mandatory-fields-in-csv-upload-for-encounters-in-forms2/32077/1 "2021-02-08T10:56:00Z")

</div>

When we try saving Forms through the Bahmni UI without entering values in **mandatory fields** the save is not successful and we get a pop-up message asking us to fill mandatory fields.

The same does not apply while uploading data through migration templates as its a direct database insertion of data and surpasses the UI validation of checking for mandatory fields. We need to ensure the CSV upload fails with a valid error message whenever a mandatory field is not filled

**Approach:**

- Read Observation properties from form definition (.json)
- Validate all mandatory fields and provide error message if field is empty.

++ @vmalini @pratibhasagar @rakeshtwhyd @angshuonline

---

<div class="post-metadata">

**Author:** ![angshuonline](https://talk.openmrs.org/user_avatar/talk.openmrs.org/angshuonline/32/4925_2.png) [@angshuonline](https://talk.openmrs.org/u/angshuonline)\
**Post date:** [February 9, 2021, 9:03am UTC](https://talk.openmrs.org/t/support-for-mandatory-fields-in-csv-upload-for-encounters-in-forms2/32077/2 "2021-02-09T09:03:52Z")

</div>

thats only possible for CSV import which conforms to a form. not otherwise.

---

<div class="post-metadata">

**Author:** ![sivareddy](https://talk.openmrs.org/letter_avatar/sivareddy/32/5_5575768a8748004e209b776fc1b2916d.png) [@sivareddy](https://talk.openmrs.org/u/sivareddy)\
**Post date:** [February 9, 2021, 9:53am UTC](https://talk.openmrs.org/t/support-for-mandatory-fields-in-csv-upload-for-encounters-in-forms2/32077/3 "2021-02-09T09:53:14Z")

</div>

Yes @angshuonline
