cds-snc / platform-forms-client

NextJS application that serves the public-facing website for Forms
https://forms-staging.cdssandbox.xyz/
MIT License
34 stars 13 forks source link

feat: Conditional Input History - Form Builder #3859

Closed thiessenp-cds closed 2 months ago

thiessenp-cds commented 3 months ago

Summary | Résumé

Adds the conditional input history feature to the form-builder and Review page only. A followup PR will add this feature to Forms-forms submissions.

More Info: Using the group history logic to allow a user to navigate the conditional logic in a form, update the user answers (form input) to only include answers that follow the users navigation. For example, a user may go down conditional logic option A but then later go back and choose conditional logic option B, then follow the option B branch. So the questions answered on option A's branch should not be included in the form submission, only the answers from the option B branch.

Testing

Note: show/hide value filtering is applied on the form-builder only. So submitting a form will still have the previous functionality of including both visible and hidden values from any show/hide elements.

Ideally test creating a form with conditional logic in both the Form-Builder Preview. Try going down a few conditional logic branches and check if the answers you inputted match the "conditional input history" you navigated within the form.

Here is an example manual test that focusses on making sure the correct "history" of answers is on the Review page. The user chose the A conditional "branch", so only those answers should be in the form submission. Not the branching answers the user also answered from going down the B conditional and C conditional branches (though those answers remain in the form inputs for user convenience).

https://github.com/cds-snc/platform-forms-client/assets/107579368/34e109cb-032b-47ef-83f9-e855b3e21c3d

github-actions[bot] commented 3 months ago

:test_tube: Review environment

https://qe6jbbouycwkmgjskewnkirulq0xshhw.lambda-url.ca-central-1.on.aws/