-
Notifications
You must be signed in to change notification settings - Fork 126
Conversation
Adds two display-only blocks so a form can show a picture or point at a video between its questions, rather than only text. They are modelled as ordinary question types that happen to carry no answer, which keeps them in the existing ordering and drag-and-drop with no new concepts. A shared ANSWER_TYPES_DISPLAY_ONLY list marks them so they are skipped when validating a submission and filtered out of exports - without that, each block would add an empty column to every CSV. Video is deliberately NOT embedded in an iframe. Embedding makes every respondent's browser contact the video host on page load, disclosing their IP address and usually setting cookies, which would quietly undermine a form marked as anonymous. It renders as a link the respondent chooses to follow. Images do render inline, since that is the point of an image block, but with referrerpolicy="no-referrer" so the form's address is not passed on, and the editor warns when the address is not on this instance. No schema change: the address and description live in the existing extraSettings. FormsQuestionType is left alone, matching how linearscale, ranking and color are already handled, so openapi.json is unaffected. Signed-off-by: global-prog <raqeeb@uosamarra.edu.iq>
b719715 to
e52688b
Compare
Chartman123
commented
Sep 11, 2026
@global-prog Please look at the corresponding issue at #624 to see if you covered all of what has been discussed there already. Also please add the AI declaration to your description if you used AI for this.
Codecov Report
✅ All modified and coverable lines are covered by tests.
📢 Thoughts on this report? Let us know!
A display-only block was skipped during validation whether or not an answer came with it, so a hand-made request could store an answer against a block that has nowhere to show it. An absent answer is still expected -- and still must not count as a missing required one -- but a present answer is now refused. The submit view never sends one for these blocks, since they emit no value, so this changes nothing for a form filled in normally. Adds tests for both halves, and for the image and video settings accepted by areExtraSettingsValid, which were not exercised before. Signed-off-by: global-prog <raqeeb@uosamarra.edu.iq>
global-prog
commented
Sep 11, 2026
Thanks, I read through #624.
It is mostly about section headings and descriptions to break up a long form, which this PR does not do: it only adds image and video blocks. So I don't think it should close #624 on its own. Section headings are what #2913 is working on.
One thing that may help there: this PR adds a shared ANSWER_TYPES_DISPLAY_ONLY list in Constants, which SubmissionService checks during validation and when building the export. I've also added the backend check you asked for on #2913: an answer submitted to a display-only block is now refused rather than skipped, with tests. If sections land as a question type they could go on the same list and get that behaviour without a second mechanism.
If you decide display content shouldn't be a question type, which is the open question on #2913, I'll follow that decision here too.
The AI declaration is added to the description.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Two display-only blocks, so a form can show a picture or point at a video between its questions rather than only text.
They are modelled as ordinary question types that happen to carry no answer, which keeps them inside the existing ordering and drag-and-drop with no new concepts to learn. A shared
ANSWER_TYPES_DISPLAY_ONLYlist marks them, so they are skipped when validating a submission and filtered out of exports — without that, each block would add an empty column to every CSV.One deliberate choice: video is a link, not an embed
Embedding would make every respondent's browser contact the video host on page load, disclosing their IP address and usually setting cookies. On a form marked as anonymous that would quietly undermine the promise being made to respondents, so the block renders as a link they choose to follow.
Images do render inline, since that is the point of an image block, but with
referrerpolicy="no-referrer"so the form's own address is not passed on. The editor also warns when the address is not on this instance:I am happy to add an opt-in embed for video if you would rather have it, but I did not think it should be the default.
Scope
extraSettingsFormsQuestionTypeis left alone, matching howlinearscale,rankingandcolorare already handled, soopenapi.jsonis unaffectedTesting
npm run lint,npm run stylelintandphp -lcleanmainwith no errors🤖 AI (if applicable)