Backward route validate#2838
Open
thomasiles wants to merge 8 commits into
Open
Conversation
We need to treat errors for routes differently based on page type. We extract a method which decides whether a page should be treated as a selection page or not so we can use it when building routes and in other places too.
To validate that routes are not pointing backwards, we need to know the page that the route is going to. We add 'goto_page', which is the page the route is pointing to, to the route input. Default routes and end of form routes don't need to know the page that they're going to. We still need the goto attribute, which is the page id of the page the route is pointing to. This is used in the form and can have more values that just page ids.
Add validation to route which checks that the route is not backwards.
Add validation to routes_input to copy any errors from the routes.
Ensure that Routes are validated when showing the routes page. This will show the user any errors, which may have been created by moving pages outside of the routes page. We also add the correct ID to the select boxes so that errors can be matched with the correct input.
Add the errors for multiple branches to the entries in the page list. The only error that is currently shown is for backward routes. This is added to the page list so that the user can see the error and correct it. There is only ever one error per page. A selection question with multiple backward routes will only show one error.
Add multiple branch error summary to page list.
ac9380c to
a81376c
Compare
hannahkc
reviewed
Jun 11, 2026
Contributor
|
Seems to work correctly and content looks good except for an extra comma. thanks! |
Co-authored-by: Hannah Content <hannah.cooper@digital.cabinet-office.gov.uk>
d4ae2de to
345256d
Compare
|
🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2838.admin.review.forms.service.gov.uk/ It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready For the sign in details and more information, see the review apps wiki page. |
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.
Add validations to the routes page for backwards routes
Trello card: https://trello.com/c/mwYaCg6h/3137-show-errors-for-backwards-routes-when-multiple-branches-are-enabled
This PR adds backward route validation to the multiple branches routes and page list.
In the routes code, we use new validation. In the page list, we use the Conditions. I think in the long term, the validation should all happen in the routes input which should be used in the page list too. While the feature is still in development, I think using the condition code for now makes sense.
The routes view:
The page list view:
Things to consider when reviewing