Required Expression

Hi all, please help me with this.
Please see the table below. I want use an expression like "only when the select_one source="other", then "text" question will be required." for the yellow cells in required. But I don't know how to deal with this.

image

It is not possible to implement relevancy on the same screen. Drop the field-list and use relevancy like ${q.1summer}='Other' (if your option value of Other is Other).

See the sample xlsrelevancy_other.xlsx (14.6 KB)

Thanks @ARIF_AZAD_KHAN.
So you mean we cannot use any expression in "required" field?

In the required column you can use 'yes/true' and 'no/false' and you can also keep blank if the data point is not mandatory.see the documentation http://xlsform.org/en/#required

Agreed with @ARIF_AZAD_KHAN that you cannot put dependent fields on the same screen. The docs at https://docs.opendatakit.org/form-question-types/#grouping-multiple-widgets-on-the-same-screen describes this in great detail.

As to the core of your question, you can put logic (e.g., selected(${q.1summer}, 'other')) in the required column, but I typically do is put that logic in relevant which hides/removes the question. I find that is a better experience for enumerators.

1 Like