From c46fbe320d842913b97134eeef11551a468633a4 Mon Sep 17 00:00:00 2001 From: Christian Hartmann Date: Tue, 5 May 2026 20:51:06 +0200 Subject: [PATCH] feat: improve handling of option limits Signed-off-by: Christian Hartmann --- lib/Service/FormsService.php | 5 ++ src/components/Questions/Question.vue | 16 ++++ src/components/Questions/QuestionMultiple.vue | 82 ++++++++++++++++++- src/mixins/QuestionMixin.js | 10 ++- 4 files changed, 110 insertions(+), 3 deletions(-) diff --git a/lib/Service/FormsService.php b/lib/Service/FormsService.php index d0e93f5b8..f4a0445e7 100644 --- a/lib/Service/FormsService.php +++ b/lib/Service/FormsService.php @@ -130,6 +130,11 @@ public function getQuestions(int $formId): array { } } + // Set `isRequired` if minimum options limit is set + if ($question['type'] === Constants::ANSWER_TYPE_MULTIPLE && $question['extraSettings']['optionsLimitMin'] > 0) { + $question['isRequired'] = true; + } + $questionList[] = $question; } } catch (DoesNotExistException $e) { diff --git a/src/components/Questions/Question.vue b/src/components/Questions/Question.vue index 4fe673ec0..8b40cbe7d 100644 --- a/src/components/Questions/Question.vue +++ b/src/components/Questions/Question.vue @@ -147,6 +147,9 @@ v-html="computedDescription" /> + + {{ infoMessage }} + {{ errorMessage }} @@ -270,6 +273,11 @@ export default { type: String, default: null, }, + + infoMessage: { + type: String, + default: null, + }, }, emits: [ @@ -329,9 +337,17 @@ export default { return !!this.errorMessage }, + hasInfo() { + return !!this.infoMessage + }, + errorId() { return `q${this.index}_error` }, + + infoId() { + return `q${this.index}_info` + }, }, // Ensure description is sized correctly on initial render diff --git a/src/components/Questions/QuestionMultiple.vue b/src/components/Questions/QuestionMultiple.vue index 50e6741f5..d7f61fdeb 100644 --- a/src/components/Questions/QuestionMultiple.vue +++ b/src/components/Questions/QuestionMultiple.vue @@ -11,6 +11,7 @@ :contentValid="contentValid" :shiftDragHandle="shiftDragHandle" :errorMessage="errorMessage" + :infoMessage="infoMessage" v-on="commonListeners">