dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36212
Re: Getting the OrgUnit id for a custom data Entry form
Thanks Timothy, you are right, good tip.
Lars
On Tue, Feb 24, 2015 at 6:02 PM, Pooben Dass <pooben@xxxxxxxx> wrote:
> Hi Timothy
>
>
>
> Thanks for sharing this. It works like a bomb!
>
>
>
> Regards
>
> Pooben
>
>
>
> *From:* Timothy Harding [mailto:hardingt@xxxxxxxxx]
> *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@xxxxxxxxx
>
> +1 541 228 4003
>
>
>
> On Tue, Feb 24, 2015 at 8:11 AM, Pooben Dass <pooben@xxxxxxxx> 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@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>
>
References