dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #14546
Re: Populating data from Excel to DHIS2 Data Entry Web Form with Internet Explorer
Thanks Morten,
After hit the change event on the fields the data values are now
saved/persisted.
*Damasceno Lopes, MSc*
*Health Information System Officer*
Friends in Global Health, Mozambique
*+258844626770 <+258%2084%20462%206770>* | *+258829502145
<damasceno.lopes@xxxxxxxxxx>*
[image: FGH]-Mozambique
2017-10-26 16:41 GMT+02:00 Morten Olav Hansen <morten@xxxxxxxxx>:
> Hi there
>
> To make sure that the data values are saved, you need to trigger the
> "change" event on each field.
>
> https://github.com/dhis2/dhis2-core/blob/master/dhis-2/dhis-
> web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry
> /javascript/form.js#L538
>
> --
> Morten Olav Hansen
> Senior Engineer, DHIS 2
> University of Oslo
> http://www.dhis2.org
>
> On Thu, Oct 26, 2017 at 9:18 PM, Damasceno Lopes <
> damascenolopess@xxxxxxxxx> wrote:
>
>> Hi!
>>
>>
>>
>> I’m trying to populate data from Excel to DHIS2 Data Entry Web Form
>> using VBA code in Excel with Internet Explorer, the data goes to form but
>> not persisted to database. Anyone already try to do that?
>>
>>
>>
>> The VBA code, tested to fill form in the demo instance:
>>
>>
>>
>> 'Before run this Macro make sure to login into dhis2-demo using Internet
>> Explorer
>>
>> Sub FillInternetForm()
>>
>> Dim IE As Object
>>
>>
>>
>> Set IE = CreateObject("InternetExplorer.Application")
>>
>>
>>
>> IE.Navigate "https://play.dhis2.org/demo/dhis-web-dataentry/index.action"
>>
>> IE.Visible = True
>>
>>
>>
>> While IE.busy
>>
>> DoEvents 'wait until IE is done loading page.
>>
>> Wend
>>
>>
>>
>> 'You have 30 seconds to choose Orgunit, form and period
>>
>> 'Eg. Sierra Leone, Emergency Response, Result
>>
>> Application.Wait Now + TimeValue("00:00:30")
>>
>>
>>
>> 'Populating Data to two first fields
>>
>> IE.document.getElementById("KFnFpbqDqji-bRowv6yZOF2-val").Focus
>>
>> IE.document.getElementById("KFnFpbqDqji-bRowv6yZOF2-val").Value = "20"
>>
>> Application.Wait Now + TimeValue("00:00:02")
>>
>> IE.document.getElementById("zFFb3bar4Ct-bRowv6yZOF2-val").Focus
>>
>> IE.document.getElementById("zFFb3bar4Ct-bRowv6yZOF2-val").Value = "30"
>>
>>
>>
>> End Sub
>>
>>
>>
>> The result:
>>
>>
>>
>>
>>
>> The Data goes to the field but not persisted, the field don’t change
>> color.
>>
>> I appreciate your help if you can provide.
>>
>>
>>
>> Thank you
>>
>> *Damasceno Lopes, MSc*
>>
>> *Health Information System Officer*
>>
>> Friends in Global Health, Mozambique
>>
>> *+258844626770 <+258%2084%20462%206770>* | *+258829502145
>> <damasceno.lopes@xxxxxxxxxx>*
>>
>> [image: FGH]
>>
>>
>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-users
>> Post to : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-users
>> More help : https://help.launchpad.net/ListHelp
>>
>>
>
Follow ups
References