formio / formio.js

JavaScript powered Forms with JSON Form Builder
https://formio.github.io/formio.js
MIT License
1.83k stars 1.04k forks source link

FIO-8510: update webform change event to bubble, 4.19.x #5652

Closed brendanbond closed 2 weeks ago

brendanbond commented 2 weeks ago

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-8510

Description

A customer uses a combination of saveDraft and skipDraftRestore to automatically save but manually load draft submissions in their application. However, change events from nested forms bubble up to the parent with modified: false, ensuring that a change in the child form will not trigger a call to saveDraft in the parent. In other words, when manually loading the parent form's submissions, the nested forms will always come back empty.

This PR ensures that, when a Webform is nested, it will pass it's change metadata up to its parent form with the modified flag set to true. That way, changes in the child form will be seen by the parent so that the call to saveDraft() will be made both in the parent and the child. This is consistent (at least conceptually) with what happens when we submit a parent form that contains nested children; not only does the child form submit its data, but the parent form's submission object contains the child form's data as well.

Dependencies

n/a

How has this PR been tested?

This is a fire ticket, but I plan on adding automated tests. I've also update the tests so that they match what we're looking for.

Checklist: