Skip to content

Fix/table and ldap question empty selection sentinel - #53

Merged
Lainow merged 2 commits into
mainfrom
fix/table-and-ldap-question-empty-selection-sentinel
Sep 1, 2026
Merged

Fix/table and ldap question empty selection sentinel#53
Lainow merged 2 commits into
mainfrom
fix/table-and-ldap-question-empty-selection-sentinel

Conversation

@RomainLvr

@RomainLvr RomainLvr commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Checklist before requesting a review

Please delete options that are not relevant.

  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • I have updated the CHANGELOG with a short functional description of the fix or new feature.
  • This change requires a documentation update.

Description

  • It fixes !46011
  • Here is a brief description of what this PR does

LdapQuestion and TableQuestion's Actor/Item(Dropdown) columns are rendered with GLPI's shared ajax dropdown widget, which always exposes a "-----" (empty) choice whose id is 0. Neither question type filtered that sentinel the way core's AbstractQuestionTypeActors already does for its own dropdown, so selecting the empty choice or clearing a previous selection saved and displayed a literal "0" instead of an empty answer.

Changes

  • LdapQuestion::prepareEndUserAnswer(): treat "0" as no answer.
  • TableQuestion: new normalizeDropdownCells() helper, applied in both prepareEndUserAnswer() and validateAnswer(), treats "0" as empty for Actor/Item(Dropdown) columns only (other column types, e.g. Number, keep 0 as a valid value).

Screenshots

Before :
image

image

After :
image

image

@RomainLvr RomainLvr self-assigned this Aug 31, 2026
@Lainow
Lainow merged commit 19ef0f1 into main Sep 1, 2026
3 checks passed
@Lainow
Lainow deleted the fix/table-and-ldap-question-empty-selection-sentinel branch September 1, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants