How to setup any conditional mandatory field?

I’d like the users to add their pass-number or id-card-number or both, but AT LEAST ONE OF THOSE PIECES OF INFORMATION in at least one of the two dedicated fields :

Welcome back to the community, @alienationfreez! You could do it as outlined in the post discussed previously. (if you have the information predefined):

Thanks for your message, Kal_Lam :slight_smile:

I’m not getting exactly the point out of the mentioned thread. At least, I think this new syntax in my screenshots is a bit closer to correctness, but I’m probably still missing relevant aspects. Do you know what is missing in order to generate a working if-first-field-empty-then-second-field-mandatory (and vice-versa) -behavior of the involved fields ? / Here the current status of the formulas as screenshots :


@alienationfreez, you should be able to do it as outlined in the image shared below:

In the survey tab of your XLSForm:

Data entry screen as seen in Enketo: both the questions cannot be left blank

Data entry screen as seen in Enketo: the second question can be left blank once filling the first question

Data entry screen as seen in Enketo: the first question can be left blank once filling the second question

Reference XLSForm:

Custom Logic (Mandatory Response).xlsx (9.6 KB)

1 Like

Merci Kal_Lam !
To make it sure : « In the survey tab of your XLSForm: » …means, the setup can exclusively be achieved via the XLSForm ? … Or is there any possibility to achieve the same setup via the UI in any browser ?
Best from South of France

And question_2 : I’d just like to make sure that adding a row ( here « #4 / Note … » in your example ) won’t disturb the functionality of the xlsx-file … it won’t, will it ?

And question_3 : Should the xlsx-file-name stay exactly the same after re-upload onto the server or can I define a new name with version-number ? / In this case, is there any name-update to proceed for correct file-link respective to the database ?

@alienationfreez, you should also be able to handle custom logic through the UI, as shown in the image below:


Row 4 is just to make the constraint work.

Thanks again, Kal_Lam,

So the solution would be to just copy-paste one of the cells mentioned in your screenshot into the custom logic field ?

If you scroll-up this thread, you see 2 screenshots where I entered formulas, which obviously do not work :

Do you see what exactly is false in my syntax / custom logic ?

@alienationfreez, you will need to understand the logic first, and then you could copy and use it. But be careful that the variable names match wit the ones you have.