nhsuk / nhsuk-prototype-kit-version-one

NHSUK Prototype Kit
https://nhsuk-prototype-kit.herokuapp.com/
MIT License
2 stars 3 forks source link

[NDPE-89] Introduce postcode search example prototype #34

Closed paul-mitchell-bjss closed 6 years ago

paul-mitchell-bjss commented 6 years ago

I found this in my archives and modernised it for the current kit. As it is a fairly complex page I've added commentary to help explain what each part does. The primary weakness is that the API key for getAddress.io will expire after 30 days. I've left a warning comment to that effect.

Otherwise, a fairly standard postcode address lookup. Enter a postcode, its format is validated and, if correct, passed to the address search API. Returned addresses are cached in session and passed to the template. If addresses are available, the template shows them as vertically stacked radio buttons. The single address selected by the user is also stored in session and displayed on the page, mostly just for demonstration purposes.

It also has fairly generic submit button disabled state management code as a bonus. No new dependencies are introduced.