You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c67d327
Browse filesBrowse the repository at this point in the historyBrowse files
feat(section): go to a chosen section after a section
A section can name where respondents go after it, as "After this
section go to" in Microsoft Forms: the next section, a later section
or the end of the form. It applies when the path leaves the section
by default, so a jump of an answer out of the section still wins, and
a jump within the section still ends at it. The editor shows the
choice on every section and counts the questions it skips as
unreachable.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Copy file name to clipboardExpand all lines: docs/DataStructure.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -282,7 +282,7 @@ Optional extra settings for some [Question Types](#question-types)
282
282
|`questionType`|`linearscale`| String |`rating`, `promoter`| Sub type, fixed at creation; `rating` is a 1 to N scale drawn as icons, `promoter` is a 0 to 10 scale whose results show the promoter score; absent for a plain scale |
283
283
|`ratingIcon`|`linearscale` with `questionType``rating`| string |`'star', 'heart', 'thumb'`| Set the icon of the rating, default: `'star'`|
284
284
|`goTo`|`dropdown, linearscale, multiple_unique`| Array | see [Jumps](#jumps)| Where to go next for an answer |
285
-
|`next`|`color, date, file, grid, long, multiple, ranking, short, time`| Integer / string | question id, `'submit'`| Where to go after the question, see [Jumps](#jumps)|
285
+
|`next`|`color, date, file, grid, long, multiple, ranking, section, short, time`| Integer / string | question id, `'submit'`| Where to go after the question or, on a section, after the section, see [Jumps](#jumps)|
286
286
287
287
### Jumps
288
288
@@ -299,6 +299,7 @@ An answer can lead to a later question or to the end of the form, as in Microsof
299
299
- Only the deprecated `datetime` accepts neither `goTo` nor `next` (400).
300
300
- A jump of the answer "Other" is for `multiple_unique` questions, as dropdowns have no answer "Other", and only matches while `allowOtherAnswer` is on.
301
301
-`next` also applies when the question is left unanswered.
302
+
-`next` on a section is where respondents go after the section, as "After this section go to" in Microsoft Forms: the id of a later section or `"submit"`; other targets are removed like other disallowed jumps. It applies when the path leaves the section towards the following section or the end of the form, so a jump of an answer out of the section wins over it, while a jump within the section still ends at it.
302
303
303
304
The respondent's path starts at the first question and follows these targets. It ends at a question that has no answer yet and a jump per answer past the following question, a jump of the answer "Other" only while `allowOtherAnswer` is on, and the questions after it appear once it is answered, as in Microsoft Forms. If such a question is optional and left empty, the form can be submitted without the questions after it. The first value of an answer decides, and answers to questions the submit view does not show, such as questions without a title, do not count. A target that is not a later question of the form, for example after the target was deleted, counts as the following question, and a jump of an option that no longer exists never matches. Questions off the path are skipped: answers to them are ignored, and their required flag does not apply. Editing a submission replaces all its stored answers, so answers to questions that are skipped now are removed.
Copy file name to clipboardExpand all lines: lib/Helper/JumpHelper.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -167,7 +167,7 @@ public static function mapJumpsOfCopies(array $questions, array $questionIdMap,
167
167
}
168
168
169
169
/**
170
-
* Remove the jumps that go to the question itself, to an earlier question or into the middle of another section, keeping the jumps to the end of the form, to later questions of the same section, to later sections and to questions that are not in the list
170
+
* Remove the jumps that go to the question itself, to an earlier question or into the middle of another section, and the jumps of a section to anything but a later section, keeping the jumps to the end of the form, to later questions of the same section, to later sections and to questions that are not in the list
171
171
*
172
172
* @param list<Question> $questions the questions of the form in their order
173
173
* @return list<Question> the questions whose jumps were removed, with their new extra settings set
@@ -187,7 +187,8 @@ public static function removeDisallowedJumps(array $questions): array {
if ($sectionNext === Constants::JUMP_TARGET_SUBMIT) {
897
+
break;
898
+
}
899
+
$targetPosition = $toPosition($sectionNext);
900
+
}
901
+
$position = $targetPosition ?? $position + 1;
888
902
}
889
903
890
904
return$visibleQuestions;
@@ -947,7 +961,7 @@ private static function awaitsAnswer(array $question, mixed $answer, int $positi
947
961
}
948
962
949
963
/**
950
-
* The jump target of a question for its answer: the target of the `goTo` entry matching the first value of the answer, else `next` on question types with `next`
964
+
* The jump target of a question for its answer: the target of the `goTo` entry matching the first value of the answer, else `next` on question types with `next` other than sections
951
965
*
952
966
* @param array $question the question
953
967
* @param mixed $answer the values of the answer to the question
0 commit comments