MAB-578 Display only grid in surveyjs#119
Open
ronnyReliefapp wants to merge 3 commits intounesco-mabfrom
Open
Conversation
src/utils/form/extractFields.ts
Outdated
| if (element.type === 'panel') { | ||
| await extractFields(element, fields, core); | ||
| } else { | ||
| if (element.type === 'resources' && element.displayOnly) { |
There was a problem hiding this comment.
Use guard clauses to handle special cases first
src/utils/form/extractFields.ts
Outdated
| await extractFields(element, fields, core); | ||
| } else { | ||
| if (element.type === 'resources' && element.displayOnly) { | ||
| // Don't store as field if question is display only |
marianorelief
suggested changes
Dec 30, 2025
There was a problem hiding this comment.
- Still Missing TypeScript types
- All parameters are implicit 'any'
- Potential null reference errors
- Line 73: element.items.map() - no check if items exists
- Line 84: element.rows.map() - no check if rows exists
- Line 90: element.columns.map() - no check if columns exists
- Line 144: element.choices.map() - no check if choices exists
- Line 188: element.choices.map() - no check if choices exists
- Use element.items?.map() ?? [] or validate before mapping
- Still Missing displayOnly validation
- DRY
Collaborator
There was a problem hiding this comment.
@marianorelief I agree with your comment, thus it's a bit out of scope as the method was already there before Ronny worked on it, that's why he didn't do typing I think
I'll keep this PR active but won't merge it now because it should be good to do a bit more testing to prevent unexpected issue to raise due to type validation
I'll create another PR, with a simplified version of the code to go faster as we have tight deadline incoming
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Backend support for display-only resources grids in SurveyJS forms. This feature allows forms to display previous form data without storing the display-only questions as database fields.
The fix prevents validation errors when saving forms with display-only resources questions that don't have a relatedName property, as these questions are meant only for display purposes and should not be persisted.
Useful links
Type of change
How Has This Been Tested?
Test A: Add display-only resources question
Test B: Display-only grid rendering
Test C: Form submission
Screenshots
N/A
Checklist:
( * == Mandatory )
More explanation
https://www.loom.com/share/05a716d61b9744faaf51fb304c21d1e5?sid=f87cf896-582a-4f76-93ae-8ceed801b145