Validation hidden values

Hello,

I'm trying to set a validation condition in hidden values.

I have a group of questions:

The first group, let's call them Type of participants:
Number of children (5 for example)
Number of parents (3 for example)

After that, I have a hidden value to calculate the added value (8 in the example).

Then, I have another group of questions for the disaggregated information by gender:

Number of female
Number of male

And again, a hidden value that calculates the total.

I want to include a validation that restricts the possibility to continue filling the document if the total by gender is not equal to the total by type of participants. Any solution?

Thanks in advance.

Hi Gustavo,

You can add all the remaining questions in a group and use a display condition on the group, something like #form/total_participant = #form/total_participant_by_gender. This way the remaining questions inside the group will only be visible if the hidden values are equal.

You can also use a label to hold the validation condition and prevent the user from proceeding, as described in Option 2 here:
https://confluence.dimagi.com/display/commcarepublic/Make+a+subset+of+questions+required