Search code examples
orbeon

Orbeon Forms: Check if Single Checkboxes are Active


We have a requirement to have several single checkbox options with a corresponding text box for each checkbox (see this demo form)

However, we want to stop the form being submitted unless one of these checkboxes has been selected.

enter image description here

We have tried various xPath options in the in the Validations & Alerts tab, but we have not had any luck so far.

Any suggestions?

Many thanks

PeteA


Solution

  • Say you have 3 such Single Checkbox fields, named a, b, and c. One way to handle this is to have, on each of those, the following validation rule:

    $a/string() = 'true' or 
    $b/string() = 'true' or 
    $c/string() = 'true'
    

    This would give:

    Testing 3 single checkboxes