Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update guides to use new 'value' option instead of 'checked' filter #223

Merged
merged 7 commits into from
Feb 14, 2025

Conversation

frankieroberto
Copy link
Contributor

Since version 9.2.0 of NHS Frontend there’s now an easier, nicer way of setting the default selected radio option or default checked checkboxes.

Instead of using the checked() filter on each item within radios and checkboxes, the value (for radios) or values (for checkbox) of the selected items can be set at the top level of the Nunjucks params.

This pull request updates the guidance to use the newer, easier way of doing this.

The checked function/filter is also deleted from the guidance site as it’s no longer needed (but will remain in the kit itself for backwards-compatibility until at least the next major release).

Version [9.2.0](https://github.com/nhsuk/nhsuk-frontend/releases/tag/v9.2.0) of NHS Frontend includes a simpler way to set the pre-selected or pre-checked options for checkboxes and radios.

This let you set `value: data.attribute` instead of having to use the `checked()` filter on each item within a checkbox or radio.

The guide and examples can now be updated to use this.
@frankieroberto frankieroberto temporarily deployed to nhs-prototyp-update-gui-lrtgv9 February 14, 2025 13:38 Inactive
frankieroberto and others added 2 commits February 14, 2025 13:50
Co-authored-by: Colin Rotherham <[email protected]>
Co-authored-by: Colin Rotherham <[email protected]>
@frankieroberto frankieroberto temporarily deployed to nhs-prototyp-update-gui-lrtgv9 February 14, 2025 13:50 Inactive
Co-authored-by: Colin Rotherham <[email protected]>
@frankieroberto frankieroberto temporarily deployed to nhs-prototyp-update-gui-lrtgv9 February 14, 2025 14:35 Inactive
@colinrotherham colinrotherham self-requested a review February 14, 2025 14:56
@frankieroberto frankieroberto merged commit caeec47 into main Feb 14, 2025
4 checks passed
@frankieroberto frankieroberto deleted the update-guides-to-use-new-value-option branch February 14, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants