Mandatory Fields Android - Don't work


Testing with the program “Information Campaign” from the demo site DHIS 2 Demo - Sierra Leone, all these four fields: IC Activity, IC Age, IC Group, IC Topic, are mandatory fields.

With the capture web app, they are enforced to be mandatory always (doesn’t matter the validation strategy, it works on both On complete and On update and insert).

But testing this program with the latest version of Android v2.6.2 I can save the events, bypassing all the mandatory fields (whatever validation strategy is chosen in the program), and upload them to the server without any data in the mandatory fields.

What am I doing wrong or I misunderstood?

Thanks a lot.


Hi @kfeina . Which version do you have on the backend?

1 Like


I did these tests on DHIS 2 Demo - Sierra Leone

So version is


Hi @kfeina

As you mentioned in your post, the current (and expected) behavior in the Android App is allowing the user to save the events even if there are empty mandatory fields. For now, we are only preventing the user from completing an event with mandatory fields.

@nancyesp and @kfeina

We’ve had a similar discussion with @jaime.bosque here in a Jira ticket:

I’ve noticed that this ticket was closed, but asked it to be reopened. In it Jaime and I agreed this was an issue as it differs from the experience in Browser

1 Like

Hi @kfeina and @Matthew_Boddie

@Matthew_Boddie , to be honest I had forgotten about why I closed that ticket. It seems I marked it as invalid after our discussion. I am doing some test and will update eventually but I believe there might be something in the backend treating differently event programs and tracker programs. Marking a field mandatory doesn’t prevent the API importing such field, and web version of the capture is not allowing this (despite the API allowing it) but Android is. I think that is what is causing this misalingment.

@kfeina , I will discuss this with the team and decide if we need to align with web or keep it the way we do. When developing the App this was decided in such a way that users could come back to their work even if some mandatory fields were not present at that time. Please, follow the JIRA issue ([ANDROAPP-4710] - Jira) for further details.



I think what is confusing is the following test case (I have an easy event program with one Mandatory field):

  • Capture Web App Test1 :
    Program Strategy: On update and insert.
    Required_Field is Mandatory, so I can not Save and exit. This is what is expected.

  • Capture Web Test2 :
    Program Strategy: On complete
    Required_Field is Mandatory, so I can not Save and exit. This is what is expected.

  • Android Test1:
    Program Strategy: On update and insert.
    Save → Required_Field is Mandatory → I select Not now
    Trying to sync data to the server, not possible. Missing mandatory data element. This is what is expected. Not to be able to sync the data to the server. Same behaviour as the web capture app.

  • Android Test2:
    Program Strategy: On complete
    Save → Required_Field is Mandatory → I select Not now
    Trying to sync data to the server: Syncronization Completed. This is what is not expected. At least in my opinion, sync this data to the server should fail, to behave exactly as the web capture app

I hope this example is more clear.

Thanks a lot for your time.


Thanks for the clear explanation @kfeina . We are trying to gather some more information and will update accordingly :slight_smile:

1 Like

Hi there @kfeina !
Can you elaborate on what the event status is for each of the cases above? The On complete or On update and insert options relate to wether the event is completed or not.
On update and insert is meant to enforce mandatory fields for all event statuses.
On complete is meat to enforce mandatory fields only when an event is completed. This status should allow users to save a non-finished version of the event, and then pick it up and complete it later.



I will try to explain it better:

As you say, I can pick up and complete the event later from the android app in any moment. This is not why I’m trying to show off.

What I’m trying to say is that a non completed event shouldn’t be uploaded to the server, at least to behave the same way as the web capture app, where you can not save an event to the server if some mandatory fields are not filled.

Hope this helps.

Thank you.


Hey @kfeina .

You are absolutely right and at the moment there is a misalignment between Android and web. We are working to see if we can come out with an alignment and update the documentation accordingly so it is clear what Mandatory really means in every scenario. Apologies for this.

1 Like