Skip to content

API accepts choice options on a question type that has none #3981

Description

@oneva-cloud

Describe the bug

The API accepts choice options on a question type that has no choices. They are stored but never used.

Steps to reproduce

  1. Create a form with a question of type short (short text).
  2. POST /ocs/v2.php/apps/forms/api/v3/forms/{formId}/questions/{questionId}/options with {"optionTexts": ["Coffee", "Tea"]}.

Expected behaviour

400: the question type takes no options.

Actual behaviour

  1. The form still shows a text field, and the two options are stored as dead rows on the question.

Versions

Forms 5.4.2.

Activity

  1. added
    bugSomething isn't working
    0. Needs triagePending approval or rejection. This issue is pending approval.
    on Nov 22, 2026
  2. added theissue type on Nov 22, 2026
  3. AndyScherzinger commented on Nov 23, 2026

    @AndyScherzinger
    Member

    Thanks for the report. Reproduced on a Nextcloud development instance with current main (Forms 5.5.0-dev): POST …/questions/{questionId}/options returned 201 and stored the options not only for short text, but for every question type without choices (long text, date, color, file, linear scale), while the form kept showing the normal input. The same code is in 5.4, so 5.4.2 is affected as well.

    The fix is in #4000: options are only accepted for dropdown, checkbox, radio button and ranking questions (option type choice) and for grid questions (row or column), anything else gets a 400. A backport to stable5.4 is requested.

    Assisted by ClaudeCode:claude-opus-5-5

  4. added a commit that references this issue on Nov 23, 2026
    142c37a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

0. Needs triagePending approval or rejection. This issue is pending approval.bugSomething isn't working

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions