Exploring how to quickly and easily design/prototype/deploy high quality digital forms for UK Gov. Based on the excellent work by DEFRA. Currently maintained by jen+forms@cautionyourblast.com at Caution Your Blast and a community collaboration between FCDO, HO, GDS, DfE, DIT, Version 1, UKHSA
In some cases it might be necessary to allow query parameters to overwrite present state values. For example, if there is an unreachable field in your form that should be pre-populated from a query parameter, and there is a chance the user may change their selection prior to entering the service that changes the value of that unreachable field, the query parameter should overwrite this value as there is no other way for the user to change their selection.
To solve this, an option allowOverwriteFromQueryParam has been added. This option will only have an effect if the component has already been given the allowPrePopulation flag.
Added allowOverwriteFromQueryParam flag
Type of change
[X] New feature (non-breaking change which adds functionality)
[X] This change requires a documentation update
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce
the testing if necessary.
[X] Added unit test and modified current tests to check the value is changed where appropriate depending on the value in the state and the presence of the allowOverwiteFromQueryParam flag
[X] Manual testing to check values are updating as expected
Checklist:
[X] I have performed a self-review of my own code
[X] I have commented my code, particularly in hard-to-understand areas
[X] I have made corresponding changes to the documentation and versioning
[X] I have updated the architecture diagrams as per Contribute.md OR added an architectural decision record entry
Description
In some cases it might be necessary to allow query parameters to overwrite present state values. For example, if there is an unreachable field in your form that should be pre-populated from a query parameter, and there is a chance the user may change their selection prior to entering the service that changes the value of that unreachable field, the query parameter should overwrite this value as there is no other way for the user to change their selection.
To solve this, an option
allowOverwriteFromQueryParam
has been added. This option will only have an effect if the component has already been given theallowPrePopulation
flag.allowOverwriteFromQueryParam
flagType of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce the testing if necessary.
allowOverwiteFromQueryParam
flagChecklist: