# Reusing functions across form in forms2

**URL:** <https://talk.openmrs.org/t/reusing-functions-across-form-in-forms2/26647>\
**Category:** Bahmni\
**Created:** [February 4, 2020, 7:54am UTC](https://talk.openmrs.org/t/reusing-functions-across-form-in-forms2/26647 "2020-02-04T07:54:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sowmika](https://talk.openmrs.org/letter_avatar/sowmika/32/6_449c533f586939b6e5f246632a46421f.png) [@sowmika](https://talk.openmrs.org/u/sowmika)\
**Post date:** [February 4, 2020, 7:54am UTC](https://talk.openmrs.org/t/reusing-functions-across-form-in-forms2/26647/1 "2020-02-04T07:54:35Z")

</div>

**Problem:**  
If we have to use the same function across forms in forms2, currently there is no way to achieve that.

**Proposed Solution:**  
A file called `'helper.js'` stores the common methods in a window object This file gets loaded on the load of consultation page, we can then use these global methods in any form/control event Have a button on Implementer interface to add content to the file, the editor will have option to export or import this file.

But with the above approach we will have one more step of maintaining another separate file. So we are not implementing that.  
  
@angshuonline @snehabagri @mksrom @vmalini @binduak

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [March 10, 2020, 9:50am UTC](https://talk.openmrs.org/t/reusing-functions-across-form-in-forms2/26647/2 "2020-03-10T09:50:53Z")

</div>

Moved to the bahmni category.
