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 bf45566
Browse filesBrowse the repository at this point in the historyBrowse files
feat(conditional): go to a question based on the value of a linear scale
Each value of a linear scale gets a row with the same select as on
options, the values at the ends with their labels, e.g. "1 - Strongly
disagree". The jumps are stored in extraSettings.goTo as
{value, target}; as on radio and dropdown questions, there is no
extraSettings.next, and a value without a jump leads to the following
question. A value is an integer from 0 to 10, the range of all scales,
and is matched as a whole number, so "04" counts as 4 as it does for
the answer itself. Narrowing the scale removes the jumps of the values
that are gone, reported in the response header X-Forms-Adjusted.
Based on the linear scale support of #3123 by TimedIn.
Co-Authored-By: TimedIn <git@timedin.net>
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/API_v3.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ Some requests succeed with their usual status, and their payload keeps its shape
37
37
38
38
| Key | Value | Set by | Meaning |
39
39
|-----|-------|--------|---------|
40
-
|`removed-jumps`| Inner list of question ids, e.g. `(3 7)`| Updating, reordering and copying questions; deleting options| Jumps to the question itself or to an earlier question, or jumps of the deleted option or of options that are not options of the question, were removed from the `extraSettings` of these questions, see [Jumps](DataStructure.md#jumps)|
40
+
|`removed-jumps`| Inner list of question ids, e.g. `(3 7)`| Updating, reordering and copying questions; deleting options; changing the bounds of a linear scale | Jumps to the question itself or to an earlier question, jumps of the deleted option or of options that are not options of the question, or jumps for values outside the scale, were removed from the `extraSettings` of these questions, see [Jumps](DataStructure.md#jumps)|
41
41
42
42
```
43
43
X-Forms-Adjusted: removed-jumps=(3 7)
@@ -64,7 +64,7 @@ When more than 100 questions lost jumps, which only a reorder can cause, `remove
64
64
65
65
### Other API changes
66
66
67
-
- Questions can jump to a later question or to the end of the form with the extra settings `goTo` (per answer, on dropdown and radio questions) or `next` (after the question, on the other types with jumps), never both (see [Jumps](DataStructure.md#jumps)). Jumps to questions of other forms are rejected, jumps for options that are not options of the question are removed, and deleting an option removes its jumps. Submissions and submission updates ignore answers to the questions the jumps skip and do not require them, the path ends at an unanswered question with a jump per answer past the following question, and an answer "Other" needs a text. Updating, reordering and copying questions removes jumps to the question itself or to an earlier question; the response header `X-Forms-Adjusted` then lists the questions concerned under `removed-jumps` (see [Adjustments by the server](#adjustments-by-the-server)). Copying or importing a form drops such jumps as well, without the header, as these create a new form.
67
+
- Questions can jump to a later question or to the end of the form with the extra settings `goTo` (per answer, on dropdown, radio and linear scale questions) or `next` (after the question, on the other types with jumps), never both (see [Jumps](DataStructure.md#jumps)). Jumps to questions of other forms are rejected, jumps for options that are not options of the question are removed, deleting an option removes its jumps, and narrowing a linear scale removes the jumps of the values that are gone. Submissions and submission updates ignore answers to the questions the jumps skip and do not require them, the path ends at an unanswered question with a jump per answer past the following question, and an answer "Other" needs a text. Updating, reordering and copying questions removes jumps to the question itself or to an earlier question; the response header `X-Forms-Adjusted` then lists the questions concerned under `removed-jumps` (see [Adjustments by the server](#adjustments-by-the-server)). Copying or importing a form drops such jumps as well, without the header, as these create a new form.
68
68
- In API version 3.0 the following endpoints were introduced/changed:
69
69
-`GET /api/v3/forms/{formId}/questions` to get all questions of a form
70
70
-`GET /api/v3/forms/{formId}/questions/{questionId}` to get a single question
@@ -473,7 +473,7 @@ Update a single or multiple properties of a question-object.
473
473
- Restrictions:
474
474
- It is **not allowed** to update one of the following key-value pairs: _id, formId, order, type_.
475
475
- The sub type `extraSettings.questionType` is fixed when the question is created. An `extraSettings` value that adds, removes or changes `questionType` is rejected with **403 Forbidden**, so send the stored `questionType` with every `extraSettings` update.
476
-
- Response: **Status-Code OK**, as well as the id of the updated question. Jumps in `extraSettings` that go to the question itself or to an earlier question are removed before saving (see [Jumps](DataStructure.md#jumps)), and the response header `X-Forms-Adjusted` then holds `removed-jumps=(<question id>)` (see [Adjustments by the server](#adjustments-by-the-server)). Jumps with an invalid structure, `goTo` or `next` on a question type without it, and ids of questions of other forms are rejected with **Status-Code Bad Request** "Invalid extraSettings, will not update." Jumps for options that are not options of the question are removed before saving, with the same header.
476
+
- Response: **Status-Code OK**, as well as the id of the updated question. Jumps in `extraSettings` that go to the question itself or to an earlier question, and jumps of a linear scale for values outside its bounds, are removed before saving (see [Jumps](DataStructure.md#jumps)), and the response header `X-Forms-Adjusted` then holds `removed-jumps=(<question id>)` (see [Adjustments by the server](#adjustments-by-the-server)). Jumps with an invalid structure, `goTo` or `next` on a question type without it, and ids of questions of other forms are rejected with **Status-Code Bad Request** "Invalid extraSettings, will not update." Jumps for options that are not options of the question are removed before saving, with the same header.
Copy file name to clipboardExpand all lines: docs/DataStructure.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -270,21 +270,21 @@ Optional extra settings for some [Question Types](#question-types)
270
270
|`columns`|`grid`| Array | - | Array of column identifiers / labels for grid questions |
271
271
|`rows`|`grid`| Array | - | Array of row identifiers / labels for grid questions |
272
272
|`questionType`|`grid`| String |`checkbox`, `number`, `radio`| Type of cell for grid questions (checkbox, numeric input, or radio) |
273
-
|`goTo`|`dropdown, multiple_unique`| Array | see [Jumps](#jumps)| Where to go next for an answer |
273
+
|`goTo`|`dropdown, linearscale, multiple_unique`| Array | see [Jumps](#jumps)| Where to go next for an answer |
274
274
|`next`|`color, date, file, grid, long, multiple, ranking, short, time`| Integer / string | question id, `'submit'`| Where to go after the question, see [Jumps](#jumps)|
275
275
276
276
### Jumps
277
277
278
278
An answer can lead to a later question or to the end of the form, as in Microsoft Forms. The form stays a flat list of questions.
279
279
280
-
-`goTo` is a list of jumps per answer: `{"optionId": 12, "target": 34}` for an option, `{"other": true, "target": "submit"}` for the answer "Other". There is at most one jump per answer.
280
+
-`goTo` is a list of jumps per answer: `{"optionId": 12, "target": 34}` for an option, `{"other": true, "target": "submit"}` for the answer "Other", `{"value": 4, "target": 34}` for a value of a linear scale. There is at most one jump per answer. A `value` is an integer from 0 to 10, the range of all scales. When a question is updated, or its form copied or imported, the server removes the jumps for values outside the scale of the question; on update the response header `X-Forms-Adjusted` then holds `removed-jumps` with the id of the question.
281
281
-`next` is one target after the whole question; on a checkbox question it applies whichever options are checked.
282
-
- A question has either jumps per answer or one jump after the question, depending on its type: `goTo` only on `dropdown` and `multiple_unique`, `next` only on the other types listed above. Sending `next` on a question type with `goTo`, or `goTo` on a question type with `next`, is rejected with 400 "Invalid extraSettings". An answer without a `goTo` entry leads to the following question.
282
+
- A question has either jumps per answer or one jump after the question, depending on its type: `goTo` only on `dropdown`, `linearscale` and `multiple_unique`, `next` only on the other types listed above. Sending `next` on a question type with `goTo`, or `goTo` on a question type with `next`, is rejected with 400 "Invalid extraSettings". An answer without a `goTo` entry leads to the following question.
283
283
- A target is the id of a later question of the same form or `"submit"` for the end of the form, and `optionId` is the id of an option of the question. Ids of questions of other forms are rejected as invalid `extraSettings`, while ids of deleted questions of the form are accepted. Updating a question removes its jumps for option ids that are not options of the question; the response header `X-Forms-Adjusted` then holds `removed-jumps` with the id of the question.
284
284
- Jumps never go back: the server removes jumps to the question itself or to an earlier question when a question is updated, reordered or copied, and when a form is copied or imported; copying or importing a form also drops `goTo` or `next` on question types without it. Updating, reordering and copying a question still succeed with their usual status, and the payload keeps its shape: a reorder adds the new `extraSettings` of the questions concerned, and a copied question is returned with its reduced `extraSettings`. The response header `X-Forms-Adjusted` lists the questions that lost jumps, e.g. `removed-jumps=(3 7)`, see [Adjustments by the server](API_v3.md#adjustments-by-the-server).
285
285
- Deleting an option removes the jumps of the question for that option; the response header `X-Forms-Adjusted` then holds `removed-jumps` with the id of the question.
286
286
- Saving a question rejects jumps with an invalid structure with 400, as any invalid `extraSettings`. Copying or importing a form keeps the jumps whose target and option it can map, and drops the others and jumps per answer with an invalid structure. The path walks ignore malformed entries.
287
-
-Question types in neither list, such as `datetime`, accept neither `goTo` nor `next` (400).
287
+
-Only the deprecated `datetime` accepts neither `goTo` nor `next` (400).
288
288
- A jump of the answer "Other" is for `multiple_unique` questions, as dropdowns have no answer "Other", and only matches while `allowOtherAnswer` is on.
289
289
-`next` also applies when the question is left unanswered.
Copy file name to clipboardExpand all lines: lib/Controller/ApiController.php
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -713,7 +713,7 @@ public function newQuestion(int $formId, ?string $type = null, ?string $subtype
713
713
* Writes the given key-value pairs into Database
714
714
* Key `order` should only be changed by reorderQuestions() and is not allowed here
715
715
*
716
-
* Jumps to the question itself or to an earlier question are removed before saving, and the header `X-Forms-Adjusted` then holds `removed-jumps` with the id of the question.
716
+
* Jumps to the question itself or to an earlier question, and jumps of a linear scale for values outside its bounds, are removed before saving, and the header `X-Forms-Adjusted` then holds `removed-jumps` with the id of the question.
717
717
* Jumps for options that are not options of the question are removed as well, with the same header. Jumps to questions of other forms are rejected as invalid `extraSettings`.
718
718
*
719
719
* @param int $formId the form id
@@ -808,6 +808,9 @@ public function updateQuestion(int $formId, int $questionId, array $keyValuePair
* The answer of a jump per answer with one answer key and a target: `option:<id>` for an option, `other` for the answer "Other" of a radio question
1116
+
* The answer of a jump per answer with one answer key and a target: `value:<value>` for a value from 0 to 10 of a linear scale, `option:<id>` for an option, `other` for the answer "Other" of a radio question
Copy file name to clipboardExpand all lines: openapi.json
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -545,6 +545,12 @@
545
545
"other": {
546
546
"type": "boolean"
547
547
},
548
+
"value": {
549
+
"type": "integer",
550
+
"format": "int64",
551
+
"minimum": 0,
552
+
"maximum": 10
553
+
},
548
554
"target": {
549
555
"oneOf": [
550
556
{
@@ -2381,7 +2387,7 @@
2381
2387
"patch": {
2382
2388
"operationId": "api-update-question",
2383
2389
"summary": "Writes the given key-value pairs into Database Key `order` should only be changed by reorderQuestions() and is not allowed here",
2384
-
"description": "Jumps to the question itself or to an earlier question are removed before saving, and the header `X-Forms-Adjusted` then holds `removed-jumps` with the id of the question. Jumps for options that are not options of the question are removed as well, with the same header. Jumps to questions of other forms are rejected as invalid `extraSettings`.\nThis endpoint allows CORS requests",
2390
+
"description": "Jumps to the question itself or to an earlier question, and jumps of a linear scale for values outside its bounds, are removed before saving, and the header `X-Forms-Adjusted` then holds `removed-jumps` with the id of the question. Jumps for options that are not options of the question are removed as well, with the same header. Jumps to questions of other forms are rejected as invalid `extraSettings`.\nThis endpoint allows CORS requests",
0 commit comments