x-govuk/govuk-form-builder

Make the link_errors argument more obvious

Closed this issue · 1 comments

It's clear that when people are using #govuk_radio_buttons_fieldset and #govuk_check_boxes_fieldset often the link_errors argument is forgotten for the first radio button or check box.

It is important because it makes the linking from #govuk_error_summary work.

Due to the nature of the builder, no element is 'aware' of its container(s) or sibling elements so creating a warning when link_elements is omitted might be difficult. Other than making it more obvious in the documentation, I'm not sure what can be done.

  • Investigate generating a warning when no radio/checkbox with link_errors is supplied to a fieldset
  • If the above is possible, perhaps it's possible to set the flag automatically. This sounds dangerous, but worth considering.
  • Failing that, make the documentation clearer

Now there's some documentation in place (#131) I'm going to close this. I don't believe it's possible to build the behaviour into the form builder without making it extremely complex and going beyond the remit of a form-building library.

If a solution comes to light I'm happy to reopen.