Getting the OrgUnit id for a custom data Entry form

Hi Devs

Is there a way to get the orgunitid when the custom entry form initially loads.

The dhis2.ou.event.orgUnitSelected event only works when an item is selected in the tree and not on the initial form load

I would like to get the selected org id when the custom form is initialy load. Currently I can get to the selected name on initial form load.

Regards

Pooben

Hello there Pooben!

I’ve seen something like this before, Vanuatu uses a few custom forms and they have the name of the facility listed somewhere in the header. I was able to get the facility UID by poking around the javascript (example below). We then use a json api request to get the facility name (but it seems like I might not have to do that if I am reading your email correctly!).

Here is a snippet where I am grabbing the Org Unit id:

dhis2.util.on( ‘dhis2.de.event.formReady’, function( event, ds ) {

var vuFacilityID = dhis2.de.currentOrganisationUnitId;

});

That variable above works all the way back to 2.14 (and maybe even further) and works great on 2.18. I hope this helps and good luck!

···

On Tue, Feb 24, 2015 at 8:11 AM, Pooben Dass pooben@hisp.org wrote:

Hi Devs

Is there a way to get the orgunitid when the custom entry form initially loads.

The dhis2.ou.event.orgUnitSelected event only works when an item is selected in the tree and not on the initial form load

I would like to get the selected org id when the custom form is initialy load. Currently I can get to the selected name on initial form load.

Regards

Pooben


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Timothy Harding

RPCV Vanuatu

hardingt@gmail.com
+1 541 228 4003

Hi Timothy

Thanks for sharing this. It works like a bomb!

Regards

Pooben

···

From: Timothy Harding [mailto:hardingt@gmail.com]
Sent: Tuesday, February 24, 2015 6:26 PM
To: Pooben Dass
Cc: DHIS 2 Developers list
Subject: Re: [Dhis2-devs] Getting the OrgUnit id for a custom data Entry form

Hello there Pooben!

I’ve seen something like this before, Vanuatu uses a few custom forms and they have the name of the facility listed somewhere in the header. I was able to get the facility UID by poking around the javascript (example below). We then use a json api request to get the facility name (but it seems like I might not have to do that if I am reading your email correctly!).

Here is a snippet where I am grabbing the Org Unit id:

dhis2.util.on( ‘dhis2.de.event.formReady’, function( event, ds ) {

 var vuFacilityID = dhis2.de.currentOrganisationUnitId;

});

That variable above works all the way back to 2.14 (and maybe even further) and works great on 2.18. I hope this helps and good luck!

Timothy Harding

RPCV Vanuatu

hardingt@gmail.com

+1 541 228 4003

On Tue, Feb 24, 2015 at 8:11 AM, Pooben Dass pooben@hisp.org wrote:

Hi Devs

Is there a way to get the orgunitid when the custom entry form initially loads.

The dhis2.ou.event.orgUnitSelected event only works when an item is selected in the tree and not on the initial form load

I would like to get the selected org id when the custom form is initialy load. Currently I can get to the selected name on initial form load.

Regards

Pooben


Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

Thanks Timothy, you are right, good tip.

Lars

···

On Tue, Feb 24, 2015 at 6:02 PM, Pooben Dass pooben@hisp.org wrote:

Hi Timothy

Thanks for sharing this. It works like a bomb!

Regards

Pooben

From: Timothy Harding [mailto:hardingt@gmail.com]
Sent: Tuesday, February 24, 2015 6:26 PM
To: Pooben Dass
Cc: DHIS 2 Developers list
Subject: Re: [Dhis2-devs] Getting the OrgUnit id for a custom data Entry form

Hello there Pooben!

I’ve seen something like this before, Vanuatu uses a few custom forms and they have the name of the facility listed somewhere in the header. I was able to get the facility UID by poking around the javascript (example below). We then use a json api request to get the facility name (but it seems like I might not have to do that if I am reading your email correctly!).

Here is a snippet where I am grabbing the Org Unit id:

dhis2.util.on( ‘dhis2.de.event.formReady’, function( event, ds ) {

 var vuFacilityID = dhis2.de.currentOrganisationUnitId;

});

That variable above works all the way back to 2.14 (and maybe even further) and works great on 2.18. I hope this helps and good luck!

Timothy Harding

RPCV Vanuatu

hardingt@gmail.com

+1 541 228 4003

On Tue, Feb 24, 2015 at 8:11 AM, Pooben Dass pooben@hisp.org wrote:

Hi Devs

Is there a way to get the orgunitid when the custom entry form initially loads.

The dhis2.ou.event.orgUnitSelected event only works when an item is selected in the tree and not on the initial form load

I would like to get the selected org id when the custom form is initialy load. Currently I can get to the selected name on initial form load.

Regards

Pooben


Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp