Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Section functionality to Nextcloud Forms
Description
This PR adds a new "Section" element type to Nextcloud Forms that acts as a visual separator to group fields logically, without affecting data storage, validation, or submission logic.
Functional Requirements
1. Section Creation
2. Editor Display
3. Form Filling Display
4. Export/View Responses Behavior
Technical Implementation
Backend Changes
Constants and Types
lib/Constants.php: AddedANSWER_TYPE_SECTION = 'section'constantlib/ResponseDefinitions.php: UpdatedFormsQuestionTypeto include"section"API Controller (
lib/Controller/ApiController.php)isRequired = falsewhen cloning formsSubmission Service (
lib/Service/SubmissionService.php)Frontend Changes
Components
src/components/Questions/QuestionSection.vue: New component for section renderingsrc/components/Questions/Question.vue: Updated to support section display and editingsrc/models/AnswerTypes.js: Added section type with appropriate icon and labelssrc/models/Constants.ts: AddedANSWER_TYPE_SECTIONconstantViews
src/views/Create.vue: Updated to pass question type to componentssrc/views/Submit.vue: Updated to filter sections from validation and storagesrc/components/Results/ResultsSummary.vue: Updated to handle sections in results displaysrc/components/Results/Submission.vue: Updated to filter sections from submission dataTesting
Backend Tests
ApiControllerTest.php
testUpdateQuestion_sectionCannotBeRequired(): Verifies sections cannot be made requiredtestNewOption_sectionCannotHaveOptions(): Verifies sections cannot have optionstestUploadFiles_sectionCannotHaveFileUploads(): Verifies sections cannot have file uploadstestGetSubmissions_sectionsAreFilteredOut(): Verifies sections are filtered from exporttestNewSubmission_sectionsAreNotStored(): Verifies sections are not stored in answersSubmissionServiceTest.php
testGetSubmissionsData_sectionsAreFilteredOut(): Verifies sections are filtered from export datatestValidateSubmission_sectionsAreIgnored(): Verifies sections are ignored in validationtestValidateSubmission_sectionsCannotBeRequired(): Verifies sections cannot be required in validationFiles Changed
Backend Files
lib/Constants.php- Added section constantlib/ResponseDefinitions.php- Updated type definitionslib/Controller/ApiController.php- Added section validation and filteringlib/Service/SubmissionService.php- Added export filteringFrontend Files
src/components/Questions/QuestionSection.vue- New section componentsrc/components/Questions/Question.vue- Updated for section supportsrc/models/AnswerTypes.js- Added section typesrc/models/Constants.ts- Added section constantsrc/views/Create.vue- Updated component propssrc/views/Submit.vue- Updated validation and storage logicsrc/components/Results/ResultsSummary.vue- Updated results displaysrc/components/Results/Submission.vue- Updated submission handlingTest Files
tests/Unit/Controller/ApiControllerTest.php- Added section teststests/Unit/Service/SubmissionServiceTest.php- Added section testsScreenshots
Before
After
Breaking Changes
None. This is a purely additive feature that does not affect existing functionality.
Notes to Reviewers
Constants::ANSWER_TYPE_SECTIONon backend,ANSWER_TYPE_SECTIONon frontend)Related Issues
This PR implements the section functionality as requested in the technical specification.