Search code examples
xpathorbeonxforms

Orbeon-forms: How to check if yes-no answer is no (not empty or no!)


I have a yes-no input and a text input and I want the text input to be required if and only if the yes-no input has the value no.

When I use $my-yesno-control eq false() as required-formula in my text input, then it will be required if the yes-no input is either empty or no, but I only want to catch the 'no' case. How can I do that?


Solution

  • If you want the expression to be true if and only if users haven't selected "Yes", then use:

    not($yes-no/string() = 'true')
    

    If you're interested on knowing more about why you need to write this, see this section of the documentation which dwells into this in more details.