Skip to content

Feat - Add configurable table question type#31

Open
RomainLvr wants to merge 7 commits into
mainfrom
feat/configurable-table-question
Open

Feat - Add configurable table question type#31
RomainLvr wants to merge 7 commits into
mainfrom
feat/configurable-table-question

Conversation

@RomainLvr

Copy link
Copy Markdown

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 !43740
  • Here is a brief description of what this PR does

Adds a new Table question type to the plugin, letting form
designers collect tabular data with fully configurable columns.

Changes

  • Configurable columns: each column has a label, a cell type (reusing a compatible core question type), an optional item type, and a "required" flag.
  • Configurable rows: min/max row count, with end users adding/removing rows dynamically.
  • End-user input: renders an editable table; select-based cells (users, items, devices…) use select2.
  • Answer display: stored answers are rendered back as a clean read-only table.
  • Required-column validation:
    • Server-side (authoritative) via QuestionTypeValidationInterface — blocks submission when a filled row leaves a required cell empty.
    • Client-side — highlights only the offending cells (red border + message) and blocks the submit before the server round-trip.
  • Disabled by default; enabled from the plugin configuration like the other advanced question types.

Tests

  • Unit + integration tests for config (de)serialization, compatible types, cell rendering, editor/helpdesk rendering, and required-column validation across every compatible column type.

Screenshots (if appropriate):

image image image image

Fill form exemple :

image image

@RomainLvr RomainLvr requested review from ccailly and stonebuzz June 24, 2026 09:59
@RomainLvr RomainLvr self-assigned this Jun 24, 2026
Comment thread public/css/advancedforms.css Outdated
Comment thread src/Model/QuestionType/TableQuestion.php Outdated
Comment thread public/js/modules/AfTableQuestionConfig.js Outdated
Comment thread public/js/modules/AfTableQuestionConfig.js Outdated
Comment thread tests/Model/QuestionType/TableQuestionValidationTest.php
@RomainLvr RomainLvr requested a review from stonebuzz June 26, 2026 08:34
Comment thread src/Model/QuestionType/TableQuestion.php Outdated
Comment thread src/Model/QuestionType/TableQuestionConfig.php
Comment thread tests/Model/QuestionType/TableQuestionValidationTest.php
Comment thread tests/Model/QuestionType/TableQuestionValidationTest.php
Comment thread tests/Model/QuestionType/TableQuestionConfigTest.php
@RomainLvr

Copy link
Copy Markdown
Author

@ccailly suggested making the column limit a validation criterion (like those already present in Forms) rather than managing it manually. The benefits would be:

  • Easier and more robust
  • Useful in other situations to have this new criterion

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