Skip to content

Conditional logic (showIf) never triggers when the source question is a multiple-choice (checkbox) question #71

@argonimos

Description

@argonimos

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Create a form with a multiple-choice (checkbox) question — e.g. "Which topics interest you?" with options A, B, C.
  2. Add a second question and set a showIf condition on it referencing the first question, using any available operator (contains, equals, in, notContains, notIn) with a single option value as the condition value.
  3. Open the form as a respondent and select the option used in the condition.
  4. Observe whether the second question appears.

Expected behaviour

The second question should become visible when the specified option is selected in the multiple-choice question, matching the configured condition.

Actual behaviour

The second question never appears regardless of which option is selected. All condition operators silently evaluate to false for multiple-choice questions. The root cause is that multiple-choice answers are stored as a string array at runtime (e.g. ['option_a', 'option_b']), but every operator in evaluateCondition was written assuming a scalar string answer:

  • contains / notContains guard on typeof answer === 'string' and short-circuit immediately for arrays.
  • equals / notEquals use strict ===, so ['option_a'] === 'option_a' is always false.
  • in / notIn call value.includes(answer) where answer is the whole array object — array identity comparison always fails.

The same bug exists in both the frontend evaluator (src/views/Respond.vue) and the backend server-side evaluator (lib/Service/ResponseService.php), meaning showIf visibility and server-side answer validation are both broken for this question type.

Server configuration

Web server: Apache

Database: MySQL

PHP version: 88.3

Nextcloud version: 33.0.0

List of activated apps formvox
Nextcloud configuration

Browser

Browser name: Firefox/Chrome/Safari/…

Browser version: 124/125/…

Operating system: Windows/Ubuntu/Mac/…

Browser log
Insert your browser log here, this could for example include:
a) The javascript console log
b) The network log
c) ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending approval or rejectionbugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions