Closed joelanman closed 1 year ago
Related proof of concept I put together previously – https://github.com/alphagov/govuk-prototype-kit/pull/1316
I think all form components except date input could be extended in the same way to pre-populate values from the data object.
We still need checked
if people write html instead of using nunjucks macros - possibly we can replace with raw nunjucks like
{{ 'checked' if data['fruit'] == 'apples' ] }}
not sure if you can write something similar for checkboxes (arrays)
Context
GOV.UK Frontend has a new feature to set values in components. We should update the kit/docs (the
checked
function is covered in the tutorial)Alternatives
Currently the kit has a function called
checked
that achieves the same thing. Maybe we can retire it in favour ofvalues
Done when
values
notchecked
checked
, for example a check in Manage Prototype