At the moment there is no way to pass values (or field-level error states/CSS classes) to the date-input when using the default item set. This means you have to redefine the items param, including CSS classes for widths, whenever the date-input is used. This encourages repeated code and is arguably more prone to error.
Is it worth having a values param and an errors param on date-input? This could fall back to values/errors passed via the items param for backward compatibility, but favouring the new items/errors props.
e.g.
{{ govukDateInput({
id: "dob",
namePrefix: "dob",
values: {
day: 4,
month: 5,
year: 20t19
},
errorMessage: 'Please enter a valid year',
errors: {
year: true
}
}) }}
I don't have an immediate need for this but it's something I noticed and thought worth suggesting in case others agree.
At the moment there is no way to pass values (or field-level error states/CSS classes) to the date-input when using the default item set. This means you have to redefine the items param, including CSS classes for widths, whenever the date-input is used. This encourages repeated code and is arguably more prone to error.
Is it worth having a values param and an errors param on date-input? This could fall back to values/errors passed via the
itemsparam for backward compatibility, but favouring the newitems/errorsprops.e.g.
I don't have an immediate need for this but it's something I noticed and thought worth suggesting in case others agree.