Skip to content

Commit

Permalink
Align location field validation error in to the text box to maintain …
Browse files Browse the repository at this point in the history
…consistency with `GDS`
  • Loading branch information
ekumachidi committed Apr 25, 2024
1 parent 828d903 commit 3e7accd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/views/candidates/school_searches/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"autocomplete-api-key-value": Rails.application.config.x.google_maps_key,
"autocomplete-error-value": @search.errors[:location].first }) do |f| %>

<%= f.govuk_error_summary %>

<%= f.govuk_text_field :location, required: true, minlength: "2", label: { text: t('helpers.label.location') }, type: "search",
data: { "autocomplete-target": "nonJsInput" } %>

Expand Down
2 changes: 1 addition & 1 deletion app/webpacker/controllers/autocomplete_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class extends Controller {
hiddenErrorMessage.classList.add("govuk-visually-hidden");
errorParagraph.prepend(hiddenErrorMessage);

locationFormGroup.appendChild(errorParagraph);
locationFormGroup.insertBefore(errorParagraph, locationFormGroup.querySelector('.govuk-body'));
locationFormGroup.classList.add("govuk-form-group--error");
}
} else {
Expand Down

0 comments on commit 3e7accd

Please sign in to comment.