cds-snc / cds-snc/platform-forms-client
The sub-elements appear differently in the form’s JSON template compared to the JSON response.
- Dominant language
- TypeScript
- Stars
- 46
- Forks
- 16
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 85
Description
Ticket: [https://cds-snc.freshdesk.com/a/tickets/25893](https://cds-snc.freshdesk.com/a/tickets/25893)
I’m trying to link the properties in the template to the appropriate data in a response JSON.
For most fields, I can use the “id”, which is used in both the template and the answers, but for subElements of repeatable elements that connection breaks down.
For example, this is the parent element plus two subElements in my template:
{"id": 78, "type": "dynamicRow”,…. "properties": {"tags": [], …, "subElements": [
{"id": 7801, "type": "textField", …, "properties": { …, "questionId": "6_Establishment", …}},
{"id": 7802, "type": "textField", …, "properties": {…, "questionId": "6_DEL", …}}
In the downloaded answers, the responses to those particular questions are represented like this:
"78":[
{"0":"fab 1 estab","1":"fab 1 del + site"},
{"0":"fab 2 estab","1":"fab 2 del ltr"}
],
Ideally, it would look like this to make it easier to link the response to the appropriate questionID (unless I’m missing something):
"78":[
{"7801":"fab 1 estab","7802":"fab 1 del + site"},
{"7801":"fab 2 estab","7802":"fab 2 del ltr"}
],
Contributor guide
Assessment
This issue has not been assessed yet.