Browse Source

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>
pull/3195/head^2
Nat Dean-Lewis 2 weeks ago committed by GitHub
parent
commit
5ef4c79d55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      app/models/validations/financial_validations.rb
  2. 2
      app/views/form/page.html.erb

2
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")

2
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 %>
<div class="govuk-button-group">
<%= f.submit "See all related answers", name: "check_errors", class: "govuk-body govuk-link submit-button-link" %>
</div>

Loading…
Cancel
Save