mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-14 02:09:44 -04:00
Only show one error for radio field and check boxes
We don't currently have any radio fields or check boxes where it's possible to get more than one validation error. However, since we never want to show more than one error at a time for a field, this changes the error messages for the relevant widgets to only show the first error if there ever were multiple.
This commit is contained in:
@@ -657,7 +657,7 @@ def govuk_checkbox_field_widget(self, field, param_extensions=None, **kwargs):
|
||||
"data-error-type": field.errors[0],
|
||||
"data-error-label": field.name
|
||||
},
|
||||
"text": " ".join(field.errors).strip()
|
||||
"text": field.errors[0]
|
||||
}
|
||||
|
||||
params = {
|
||||
@@ -710,7 +710,7 @@ def govuk_checkboxes_field_widget(self, field, wrap_in_collapsible=False, param_
|
||||
"data-error-type": field.errors[0],
|
||||
"data-error-label": field.name
|
||||
},
|
||||
"text": " ".join(field.errors).strip()
|
||||
"text": field.errors[0]
|
||||
}
|
||||
|
||||
# returns either a list or a hierarchy of lists
|
||||
@@ -765,7 +765,7 @@ def govuk_radios_field_widget(self, field, param_extensions=None, **kwargs):
|
||||
"data-error-type": field.errors[0],
|
||||
"data-error-label": field.name
|
||||
},
|
||||
"text": " ".join(field.errors).strip()
|
||||
"text": field.errors[0]
|
||||
}
|
||||
|
||||
# returns either a list or a hierarchy of lists
|
||||
|
||||
Reference in New Issue
Block a user