Open lostie opened 8 years ago
@robmckinnon @misaka @alan @ministryofjustice/ruby Could someone review this PR please?
LGTM 👍
It's a breaking change for existing apps isn't it? In that case can we hold off a sec? Happy to have a closer look on Monday when I'm back in the office.
@csutter Yes, it will be a breaking change for the existent apps, but we can flag this in the versioning (bump the major version, which I haven't done yet, intentionally).
Also, the breaking changes will happen only if you actively update the gem in the applications.
I'm happy to get it reviewed on Monday, regardless ;)
The gem already lets you set a radio button question as the fieldset legend text, as documented here: https://govuk-elements-rails-guide.herokuapp.com/form-elements#form-stacked-radio-buttons
@lostie Can you use the fieldset legend to set the question for a radio button fieldset, instead of the approach in this PR?
@robmckinnon I was already using that (as described).
This issue appeared once I got an error in the radio button fieldset (e.g maybe an unusual case, but none of the options was selected by default).
The error section, as it stands, doesn't display the name of the field correctly.
@lostie I see what you mean. Usually we override the error helper to get more granular control over the message like so:
activemodel:
errors:
models:
challenged_decision_form:
attributes:
challenged_decision:
inclusion: Select whether you have challenged the decision with HMRC first
This does require you to set errors.format
to exclude the field name though:
en:
errors:
format: "%{message}"
... which means that you will need to manually specify all error messages for every field across the app.
I think it would be good for us to have a think about whether that's still the best way of doing this. /cc @robmckinnon @aliuk2012
Solves https://github.com/ministryofjustice/govuk_elements_form_builder/issues/63
This allows us to be able to configure both the locale for the attribute label and the labels for each of the choices, e.g:
Whereas before it was not possible to do this as the
location
key was being used to define the list of choices, so we could not define the actual label for thelocation
attribute itself.