Altinn / Altinn/app-frontend-react
Ability to control validation on the 'back to summary' button
- Dominant language
- TypeScript
- Stars
- 21
- Forks
- 33
- Avg merge
- 6d 23h
- Merged PRs (30d)
- 3
Description
### Description
In #927 the validation behavior for the 'back to summary' button was changed, but still there's confusion about that button and how it is supposed to work, so I propose we make it configurable.
To make this all easier to understand, imagine we have a form with two pages (`page1` and `summary`). When the user fills out the form in `page1` and click `next` they now go to `summary` where they'll see summaries of the data they entered in the form. Clicking the edit-button on any part of the summary takes them back to `page1` again, but now the `next` button is renamed 'back to summary'.
We should allow for a few options:
- Behave the same way as a 'next' button on `page1` (following the `validateOnNext` configuration there)
- Do not show any validations at all, regardless of the settings for the 'next' button on `page1`
- Use a custom setting, similar to `validateOnNext`, but only for the 'back to summary' button
### Proposed solution
Instead of configuring this directly on each `Summary` component, I think it might be better to put this in the page settings. In that case, the settings should be looked for in this order:
1. If there are settings on the current page (`page1`) for what the 'back to summary' button should do, those should be used. Otherwise,
2. If there are settings on the target summary page (`summary`), those should be used. Otherwise,
3. If there are settings on the layout set (`Settings.json`), those should be used. Otherwise,
4. If there are settings for all layout-sets (`layout-sets.json`), those should be used.
### Relevant issue(s)
- #927
- #504
- https://altinn.slack.com/archives/C02EJ9HKQA3/p1708603942359629
- #1863
Contributor guide
Research direction
Start by tracing the Summary component and the page, Settings.json, and layout-sets.json configuration paths, then review the behavior discussed in #927 and #1863. Define the available validation options and verify that settings resolve in the proposed current-page, target-summary, layout-set, and all-layout-sets precedence order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100