Premature "This field is required" error when a previously hidden field is made mandatory by a program rule (Capture app)

Hi everyone,

I ran into a Capture app (web) issue a couple of months back and logged it in Jira. It hasn’t been picked up yet, so I wanted to raise it here to see whether others have hit the same thing and whether anyone has found a workaround.

When a data element (DE) field X is first hidden via program rule A, and then later made visible and mandatory via program rule B (once program rule A’s condition is no longer valid & program rule B’s condition for making the DE mandatory is valid), the web Capture app shows a “This field is required” error by default before any user interaction has taken place:

A few things worth highlighting:

  • The error still appears after setting rule A’s priority to 1 and rule B’s priority to 2.
  • It doesn’t happen if field X is never hidden and is only made mandatory by rule B. In that case the field behaves correctly and no premature error is shown.
  • It doesn’t happen in Android app.

To reproduce:

  1. Create a data element field X.
  2. Create program rule A that hides field X when a condition is met, e.g. a Yes/No data element “Has condition” with the expression #{hasCondition} == true.
  3. Create program rule B that makes field X mandatory, using the oppsosite condition: #{hasCondition} != true.
  4. In the Capture app (web), enter data so that rule A’s condition is true so that field X becomes hidden.
  5. Then change the data so that rule A’s condition is no longer true so that field X becomes visible again and rule B makes it mandatory.

I’d really appreciate it if anyone has found a workaround for this issue while we wait for it to be fixed.

Thanks!

Hi @malekpour

I need to ask this question: what if program rule is more specific so that it is not triggered until a certain value select? For example, instead of #{hasCondition} != true we can be specific by changing it to #{hasCondition == false.

However, while asking you this question, I feel that I missed something which would be clearer to me if we have the workflow.

Thanks!

Hi @Gassim,

Thanks for your reply. No, it’s not working by using more specific condition. Here is an example workflow:

Let’s assume that I have a YES/NO question as “Do you smoke?”. Then, only if the answer to this question is YES, I want to ask an additional mandatory question as “For how many years?”.

PR1: Hide “For how many years?” if “Do you smoke?” != YES
PR2: Mandate “For how many years?” if “Do you smoke?” == YES

The reason for PR2 is that it’s not possible to hide a compulsory DE; thus, we need to manually make it mandatory via a PR.

Thanks a lot!