Skip to content

Commit

Permalink
Fix errors on sidemenu links for section C subsection links. Fix erro…
Browse files Browse the repository at this point in the history
…rs not appearing on subfields on first render
  • Loading branch information
DaniBitZesty committed Jun 18, 2024
1 parent b73ef94 commit 54e6cbb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/assets/javascripts/frontend/form-validation.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ window.FormValidation =
@validates = true
$(".govuk-form-group--error").removeClass("govuk-form-group--error")
$(".govuk-error-message").empty()
$(".steps-progress-bar .js-step-link").removeClass("step-errors")
$(".steps-progress-bar a.js-step-link").parent().removeClass("step-errors")

clearErrors: (container) ->
if container.closest(".question-financial").length > 0
Expand Down Expand Up @@ -190,7 +190,7 @@ window.FormValidation =

addSubfieldError: (question, subquestion) ->
questionRef = question.attr("data-question_ref")
input = $(subquestion).find('input,textarea,select').filter(':visible')
input = $(subquestion).find('input,textarea,select')
if input.length
label = @extractText(input.attr('id'))
incompleteMessage = "Question #{questionRef} is incomplete. It is required and must be filled in."
Expand Down Expand Up @@ -954,6 +954,7 @@ window.FormValidation =
stepContainer.find(".govuk-form-group--error").removeClass("govuk-form-group--error")
stepContainer.find(".govuk-error-message").empty()
$(".steps-progress-bar .js-step-link[data-step='" + currentStep + "']").removeClass("step-errors")
$("li, a", $(".steps-progress-bar .js-step-link[data-step='" + currentStep + "']")).removeClass("step-errors")

for question in stepContainer.find(".question-block")
question = $(question)
Expand Down

0 comments on commit 54e6cbb

Please sign in to comment.