I have form like this: https://demo.orbeon.com/demo/fr/orbeon/builder/edit/f34f17613d9dbce14bcdf1219b1a7a6babaeebe2
I want to add validation like this:
Should I create some action, that iterate over all 'yes/no' fields, check their value and raise an error if detect above situation?
My main problem is how to iterate over all 'yes/no' fields and detect this situation.
Assuming you name your field yes-no
, then the following expression will do it:
string() = 'false' or
count(//yes-no[string() = 'true']) <= 1
With this expression you're saying that an answer is valid if either:
And for more on that string() = 'true'
business, see Testing on a Yes No Answer field.