From 5ef4c79d55744aca296c0c103233caff30e9654c Mon Sep 17 00:00:00 2001 From: Nat Dean-Lewis <94526761+natdeanlewissoftwire@users.noreply.github.com> Date: Tue, 3 Mar 2026 12:00:10 +0000 Subject: [PATCH] CLDC-4241: Fix empty check values page bug (#3193) * CLDC-4241: don't set check_errors on submit * CLDC-4241: use link rather than submit form for see all related answers * CLDC-4241: fix brent hard max error type inconsistency * CLDC-4241: update page routing spec * CLDC-4241: pass errors through to check errors page and simplify in doing so * CLDC-4241: add comment to explain unusual code order * CLDC-4241: revert test change * Update app/views/form/page.html.erb Co-authored-by: Oscar Richardson <116292912+oscar-richardson-softwire@users.noreply.github.com> --------- Co-authored-by: Oscar Richardson <116292912+oscar-richardson-softwire@users.noreply.github.com> --- app/models/validations/financial_validations.rb | 2 +- app/views/form/page.html.erb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/validations/financial_validations.rb b/app/models/validations/financial_validations.rb index 6f135aa39..3dd6890be 100644 --- a/app/models/validations/financial_validations.rb +++ b/app/models/validations/financial_validations.rb @@ -228,7 +228,7 @@ private end if record.weekly_value(record["brent"]) > rent_range.hard_max - record.errors.add :brent, :over_hard_max, message: I18n.t("validations.lettings.financial.brent.above_hard_max") + record.errors.add :brent, :above_hard_max, message: I18n.t("validations.lettings.financial.brent.above_hard_max") record.errors.add :beds, I18n.t("validations.lettings.financial.beds.rent_above_hard_max") record.errors.add :uprn, I18n.t("validations.lettings.financial.uprn.rent_above_hard_max") record.errors.add :la, I18n.t("validations.lettings.financial.la.rent_above_hard_max") diff --git a/app/views/form/page.html.erb b/app/views/form/page.html.erb index 42097c4e6..67ed12c1b 100644 --- a/app/views/form/page.html.erb +++ b/app/views/form/page.html.erb @@ -76,6 +76,8 @@ <% end %> <% if @pages_with_errors_count > 1 %> + <%# Hidden form submit ensures pressing Enter triggers "Save and continue" as the user would expect rather than "See all related answers"%> + <%= f.submit submit_button_text(@page, request.query_parameters["referrer"]), class: "govuk-visually-hidden", tabindex: -1, "aria-hidden": true %>
<%= f.submit "See all related answers", name: "check_errors", class: "govuk-body govuk-link submit-button-link" %>