Show error message if checkbox wasn’t checked

Because we were redirecting in all cases the error message wasn’t being
shown.

This commit changes the endpoint to respond with content (including an
error message) if the `POST` is not successful.
This commit is contained in:
Chris Hill-Scott
2021-05-17 12:09:43 +01:00
parent 7d66dadcd7
commit e2ef8cd36e
3 changed files with 116 additions and 47 deletions

View File

@@ -1297,7 +1297,9 @@ class ConfirmBroadcastForm(StripWhitespaceForm):
self.confirm.label.text = self.generate_label(channel, max_phones)
if service_is_live:
self.confirm.validators += (DataRequired(),)
self.confirm.validators += (
DataRequired('You need to confirm that you understand'),
)
confirm = GovukCheckboxField("Confirm")