# Make field mandatory program action not working

**URL:** <https://community.dhis2.org/t/make-field-mandatory-program-action-not-working/49685>\
**Category:** Support - Assistance technique\
**Created:** [19 September 2022 08:36 UTC](https://community.dhis2.org/t/make-field-mandatory-program-action-not-working/49685 "2022-09-19T08:36:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fernandoshake](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/f/9de053/32.png) [@fernandoshake](https://community.dhis2.org/u/fernandoshake)\
**Post date:** [19 September 2022 08:36 UTC](https://community.dhis2.org/t/make-field-mandatory-program-action-not-working/49685/1 "2022-09-19T08:36:45Z")

</div>

Hi all,

I created program rules to make some fields mandatory, but they are not working. This is how the PR expression and rule action of one of the program rule look like:

 ![image](https://dhis2.b-cdn.net/uploads/default/original/3X/b/8/b89573539a1828216bf4e00fb1c8714d3ba89fbc.png)

 ![image](https://dhis2.b-cdn.net/uploads/default/original/3X/7/1/7138a514e8dfc5701b97c20dddd81d7d72c32ca3.png)

Thanks

---

<div class="post-metadata">

**Author:** ![e4eDHIS2](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/e/bc79bd/32.png) [@e4eDHIS2](https://community.dhis2.org/u/e4eDHIS2)\
**Post date:** [19 September 2022 09:48 UTC](https://community.dhis2.org/t/make-field-mandatory-program-action-not-working/49685/2 "2022-09-19T09:48:40Z")

</div>

Hello, Fernando Shake.

In response to your inquiry, I recommend that you make the data elements assigned to your program stage compulsory, as opposed to creating program rules.

 ![](https://dhis2.b-cdn.net/uploads/default/original/3X/2/6/26056a528be96279262538288865e49a90e67c6f.png)

I hope our response is able to solve the issue you were facing.

With ♥ from the Dhistance Team.

[DHISTANCE.com](https://dhistance.com/): The Easiest DHIS2 Setup system. Up and running in 5 minutes!

No technical knowledge needed! Great Support with Data Security/Confidentiality.

![](https://dhis2.b-cdn.net/uploads/default/original/3X/3/d/3d8cc537a93ad2317b7ff7a71035fb8a46dbb676.png)

---

<div class="post-metadata">

**Author:** ![fernandoshake](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/f/9de053/32.png) [@fernandoshake](https://community.dhis2.org/u/fernandoshake)\
**Post date:** [19 September 2022 10:21 UTC](https://community.dhis2.org/t/make-field-mandatory-program-action-not-working/49685/3 "2022-09-19T10:21:54Z")

</div>

Hi @e4eDHIS2,

We opted for this path because all data elements made mandatory in a program stage could not be hidden using program rules in android. in other words, we created some program rules to hide data elements which are mandatory, but the PRs do not work in android. In this case what can we do?

Thanks

---

<div class="post-metadata">

**Author:** ![waviles](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/w/e36b37/32.png) [@waviles](https://community.dhis2.org/u/waviles)\
**Post date:** [19 September 2022 14:07 UTC](https://community.dhis2.org/t/make-field-mandatory-program-action-not-working/49685/4 "2022-09-19T14:07:40Z")

</div>

Hi @fernandoshake

Can you try to change the rule expression to something different than true? I´d suggest something like d2:hasValue(V{event\_date}) to test.

Android won´t hide required fields. If you leave that expression you will never be able to hide them (depending on priorities).

Can you elaborate a little bit more on your use case?

William
