Skip to content

Commit 0b746df

Browse files
Merge pull request #760 from TechnologyEnhancedLearning/Develop/Fixes/TD-4180-DIG409-An-error-is-present-and-correct-however-is-not-programmatically-associated-with-field
TD-4180: Error message changed according to NHS design pattern
2 parents 9874f1b + 840d40e commit 0b746df

File tree

3 files changed

+40
-21
lines changed

3 files changed

+40
-21
lines changed

LearningHub.Nhs.WebUI/Views/Account/CreateAccountCountrySearch.cshtml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,27 @@
2121
}
2222
<h1 class="nhsuk-heading-xl">Search for your country</h1>
2323
<form asp-controller="Account" asp-action="CreateAccountCountrySelection" method="get">
24-
<input type="hidden" name="formSubmission" value="true">
24+
<input type="hidden" name="formSubmission" value="true">
25+
<div class="@(errorHasOccurred ? "nhsuk-form-group input-validation-error" : "nhsuk-form-group")">
2526
<label for="FilterText" class="nhsuk-body-l nhsuk-u-font-size-19 nhsuk-u-margin-bottom-3">Search for example, England</label>
26-
<div class="nhsuk-form-group search-box-container" style="white-space:nowrap">
27+
@if (errorHasOccurred)
28+
{
29+
<span class="nhsuk-error-message">
30+
<span class="nhsuk-u-visually-hidden">Error:</span> @CommonValidationErrorMessages.SearchTermRequired
31+
</span>
32+
}
33+
<div class="nhsuk-form-group search-box-container" style="white-space:nowrap">
2734
<input class="nhsuk-input nhsuk-search__input" type="search" autocomplete="off" id="FilterText" name="FilterText" placeholder="" value="@Model.FilterText" @if (errorHasOccurred)
2835
{
2936
<text>aria-describedby="error-summary-title custom-validation-error"</text>
3037
}>
31-
<button class="nhsuk-search__submit" type="submit">
32-
<svg class="nhsuk-icon nhsuk-icon__search" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
33-
<path d="M19.71 18.29l-4.11-4.1a7 7 0 1 0-1.41 1.41l4.1 4.11a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42zM5 10a5 5 0 1 1 5 5 5 5 0 0 1-5-5z"></path>
34-
</svg>
35-
<span class="nhsuk-u-visually-hidden">Search</span>
36-
</button>
37-
</div>
38-
<div>
39-
@if (errorHasOccurred)
40-
{
41-
<span id="custom-validation-error" class="custom-validation-error">@CommonValidationErrorMessages.SearchTermRequired</span>
42-
}
38+
<button class="nhsuk-search__submit" type="submit">
39+
<svg class="nhsuk-icon nhsuk-icon__search" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
40+
<path d="M19.71 18.29l-4.11-4.1a7 7 0 1 0-1.41 1.41l4.1 4.11a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42zM5 10a5 5 0 1 1 5 5 5 5 0 0 1-5-5z"></path>
41+
</svg>
42+
<span class="nhsuk-u-visually-hidden">Search</span>
43+
</button>
44+
</div>
4345
</div>
4446
</form>
4547

LearningHub.Nhs.WebUI/Views/Account/CreateAccountSearchRole.cshtml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,20 @@
2525

2626
<form asp-controller="Account" asp-action="CreateAccountCurrentRole" method="get">
2727
<input type="hidden" name="formSubmission" value="true">
28-
28+
<div class="@(errorHasOccurred ? "nhsuk-form-group input-validation-error" : "nhsuk-form-group")">
2929
<label for="FilterText" class="nhsuk-body-l nhsuk-u-font-size-19 nhsuk-u-margin-bottom-3">Use a generic term to best describe your role</label>
30+
@if (errorHasOccurred)
31+
{
32+
<span class="nhsuk-error-message">
33+
<span class="nhsuk-u-visually-hidden">Error:</span> @CommonValidationErrorMessages.SearchTermRequired
34+
</span>
35+
}
3036
<div class="nhsuk-form-group search-box-container nhsuk-u-padding-bottom-5" style="white-space:nowrap">
3137
<input type="hidden" name="RegionId" value="@Context.Request.Query["RegionId"]">
32-
<input class="nhsuk-input nhsuk-search__input" type="search" autocomplete="off" id="FilterText" name="FilterText" placeholder="" value="@Model.FilterText">
38+
<input class="nhsuk-input nhsuk-search__input" type="search" autocomplete="off" id="FilterText" name="FilterText" placeholder="" value="@Model.FilterText" @if (errorHasOccurred)
39+
{
40+
<text>aria-describedby="error-summary-title custom-validation-error"</text>
41+
}>
3342
<button class="nhsuk-search__submit" type="submit">
3443
<svg class="nhsuk-icon nhsuk-icon__search" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
3544
<path d="M19.71 18.29l-4.11-4.1a7 7 0 1 0-1.41 1.41l4.1 4.11a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42zM5 10a5 5 0 1 1 5 5 5 5 0 0 1-5-5z"></path>
@@ -38,8 +47,7 @@
3847
</button>
3948

4049
</div>
41-
42-
50+
</div>
4351
</form>
4452

4553
<details class="nhsuk-details nhsuk-expander">

LearningHub.Nhs.WebUI/Views/Account/CreateAccountWorkPlaceSearch.cshtml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,22 @@
2525

2626
<form asp-controller="Account" asp-action="CreateAccountWorkPlace" method="get">
2727
<input type="hidden" name="formSubmission" value="true">
28-
28+
<div class="@(errorHasOccurred ? "nhsuk-form-group input-validation-error" : "nhsuk-form-group")">
2929
<label for="FilterText" class="nhsuk-body-l nhsuk-u-font-size-19 nhsuk-u-margin-bottom-3">
3030
Enter the name, postcode or Organisation Date Service (ODS) code of your place of work.
3131

3232
</label>
33+
@if (errorHasOccurred)
34+
{
35+
<span class="nhsuk-error-message">
36+
<span class="nhsuk-u-visually-hidden">Error:</span> @CommonValidationErrorMessages.SearchTermRequired
37+
</span>
38+
}
3339
<div class="nhsuk-form-group search-box-container nhsuk-u-padding-bottom-5" style="white-space:nowrap">
34-
<input class="nhsuk-input nhsuk-search__input" type="search" autocomplete="off" id="FilterText" name="FilterText" placeholder="" value="@Model.FilterText">
40+
<input class="nhsuk-input nhsuk-search__input" type="search" autocomplete="off" id="FilterText" name="FilterText" placeholder="" value="@Model.FilterText" @if (errorHasOccurred)
41+
{
42+
<text>aria-describedby="error-summary-title custom-validation-error"</text>
43+
}>
3544
<button class="nhsuk-search__submit" type="submit">
3645
<svg class="nhsuk-icon nhsuk-icon__search" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
3746
<path d="M19.71 18.29l-4.11-4.1a7 7 0 1 0-1.41 1.41l4.1 4.11a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42zM5 10a5 5 0 1 1 5 5 5 5 0 0 1-5-5z"></path>
@@ -40,7 +49,7 @@
4049
</button>
4150

4251
</div>
43-
52+
</div>
4453
</form>
4554

4655
<details class="nhsuk-details nhsuk-expander">

0 commit comments

Comments
 (0)