Skip to content

Fix - Prevent unnecessary container refresh breaking mandatory field validation#1050

Merged
stonebuzz merged 1 commit into
mainfrom
fix/mandatory-dropdown-validation-after-refresh
Oct 23, 2025
Merged

Fix - Prevent unnecessary container refresh breaking mandatory field validation#1050
stonebuzz merged 1 commit into
mainfrom
fix/mandatory-dropdown-validation-after-refresh

Conversation

@RomainLvr

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

Problem

After upgrading to GLPI 11, tickets with mandatory dropdown fields from the Fields plugin couldn't be saved. The Save button did nothing even when valid values were selected.

Root cause:

  • GLPI PR fix(core): Mandatory fields not enforced glpi-project/glpi#21092 introduced strict validation for mandatory fields using addEventListener on form submit
  • Container refresh triggered on every form field change (category, priority, etc.)
  • Each refresh generated new random DOM IDs for dropdowns
  • Validation event listeners remained attached to old (removed) elements with old IDs
  • Forms blocked because validation checked non-existent DOM elements

Solution

Only refresh the container when its visibility state actually changes (from empty to visible or vice versa). This prevents unnecessary DOM replacement that breaks validation event listeners attached by GLPI core.

Screenshots (if appropriate):

@stonebuzz

Copy link
Copy Markdown
Contributor

Waiting for community feedback

@stonebuzz stonebuzz merged commit df59be7 into main Oct 23, 2025
3 checks passed
@stonebuzz stonebuzz deleted the fix/mandatory-dropdown-validation-after-refresh branch October 23, 2025 12:22
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.

Cannot save tickets when additional field is enabled

3 participants