Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error fixes #2968

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually not sure about this, cause this somehow might impact some weird conditional questions if we have a question where the subfield is hidden πŸ€”

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
Loading