Skip to content

Commit 1e9e8a5

Browse files
authored
Merge pull request #3393 from TechnologyEnhancedLearning/Develop/Features/TD-4624-Addregexvalidationofprofessionalregistrationnumberfieldthroughouttheapplication
TD- 4624 addregexvalidationofprofessionalregistrationnumberfieldthroughouttheapplication
2 parents b97887c + ed1d0f2 commit 1e9e8a5

File tree

4 files changed

+48
-26
lines changed

4 files changed

+48
-26
lines changed

DigitalLearningSolutions.Web/Views/MyAccount/EditDetails.cshtml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,15 @@
3232
nameof(Model.Answer5),
3333
nameof(Model.Answer6),
3434
};
35-
35+
var professionalRegistrationNumberError = ViewData.ModelState["ProfessionalRegistrationNumber"]?.Errors.FirstOrDefault();
36+
if (professionalRegistrationNumberError == null)
37+
{
3638
<vc:error-summary order-of-property-names="@orderOfPropertyNames" />
39+
}
40+
if (professionalRegistrationNumberError != null)
41+
{
42+
<partial name="_ProfessionalRegistrationNumberError" model=@(professionalRegistrationNumberError.ErrorMessage) />
43+
}
3744
}
3845

3946
<h1 class="nhsuk-heading-xl" id="app-page-heading">Edit details</h1>

DigitalLearningSolutions.Web/Views/Register/LearnerInformation.cshtml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,28 @@
1111
<div class="nhsuk-grid-row">
1212
<div class="nhsuk-grid-column-full">
1313
@if (errorHasOccurred)
14-
{
15-
<vc:error-summary order-of-property-names="@(new[] {
16-
nameof(Model.JobGroup),
17-
nameof(Model.HasProfessionalRegistrationNumber),
18-
nameof(Model.ProfessionalRegistrationNumber),
19-
nameof(Model.Answer1),
20-
nameof(Model.Answer2),
21-
nameof(Model.Answer3),
22-
nameof(Model.Answer4),
23-
nameof(Model.Answer5),
24-
nameof(Model.Answer6) })" />
25-
}
14+
{
15+
16+
var professionalRegistrationNumberError = ViewData.ModelState["ProfessionalRegistrationNumber"]?.Errors.FirstOrDefault();
17+
if (professionalRegistrationNumberError == null)
18+
{
19+
<vc:error-summary order-of-property-names="@(new[] {
20+
nameof(Model.JobGroup),
21+
nameof(Model.HasProfessionalRegistrationNumber),
22+
nameof(Model.ProfessionalRegistrationNumber),
23+
nameof(Model.Answer1),
24+
nameof(Model.Answer2),
25+
nameof(Model.Answer3),
26+
nameof(Model.Answer4),
27+
nameof(Model.Answer5),
28+
nameof(Model.Answer6) })" />
29+
}
30+
if (professionalRegistrationNumberError != null)
31+
{
32+
<partial name="_ProfessionalRegistrationNumberError" model=@(professionalRegistrationNumberError.ErrorMessage) />
33+
34+
}
35+
}
2636

2737
<h1 class="nhsuk-heading-xl">Learner information</h1>
2838

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@model string
2+
@{
3+
4+
}
5+
<div class="nhsuk-error-summary" aria-labelledby="error-summary-title" role="alert" tabindex="-1">
6+
<h2 class="nhsuk-error-summary__title" id="error-summary-title">
7+
There is a problem
8+
</h2>
9+
<div class="nhsuk-error-summary__body">
10+
<span class="nhsuk-error-message" id="ProfessionalRegistrationNumber-error">
11+
<span class="nhsuk-u-visually-hidden">Error:</span> <span class="nhsuk-error-message" id="ProfessionalRegistrationNumber-error">
12+
<span class="nhsuk-u-visually-hidden">Error:</span>
13+
@Html.Raw(Model)
14+
</span>
15+
</span>
16+
</div>
17+
</div>

DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/EditDelegate/Index.cshtml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,7 @@
3434
}
3535
if (professionalRegistrationNumberError != null)
3636
{
37-
<div class="nhsuk-error-summary" aria-labelledby="error-summary-title" role="alert" tabindex="-1">
38-
<h2 class="nhsuk-error-summary__title" id="error-summary-title">
39-
There is a problem
40-
</h2>
41-
<div class="nhsuk-error-summary__body">
42-
<span class="nhsuk-error-message" id="ProfessionalRegistrationNumber-error">
43-
<span class="nhsuk-u-visually-hidden">Error:</span> <span class="nhsuk-error-message" id="ProfessionalRegistrationNumber-error">
44-
<span class="nhsuk-u-visually-hidden">Error:</span>
45-
@Html.Raw(professionalRegistrationNumberError.ErrorMessage)
46-
</span>
47-
</span>
48-
</div>
49-
</div>
37+
<partial name="_ProfessionalRegistrationNumberError" model=@(professionalRegistrationNumberError.ErrorMessage) />
5038
}
5139
}
5240

0 commit comments

Comments
 (0)