Skip to content

Commit 7eec005

Browse files
Added validation for phone textbox
1 parent 10b21c1 commit 7eec005

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

apps/paf/fields/index.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ module.exports = {
582582
},
583583
'crime-location-phone': {
584584
className: ['govuk-input', 'govuk-input--width-20'],
585-
validate: [{ type: 'maxlength', arguments: 20 }]
585+
validate: ['required', { type: 'maxlength', arguments: 20 }]
586586
},
587587
'crime-another-location': {
588588
isPageHeading: true,
@@ -646,7 +646,7 @@ module.exports = {
646646
},
647647
'crime-another-location-phone': {
648648
className: ['govuk-input', 'govuk-input--width-20'],
649-
validate: [{ type: 'maxlength', arguments: 20 }]
649+
validate: ['required', { type: 'maxlength', arguments: 20 }]
650650
},
651651
'report-person': {
652652
mixin: 'radio-group',
@@ -796,7 +796,7 @@ module.exports = {
796796
},
797797
'report-person-location-phone': {
798798
className: ['govuk-input', 'govuk-input--width-20'],
799-
validate: [{ type: 'maxlength', arguments: 20 }]
799+
validate: ['required', { type: 'maxlength', arguments: 20 }]
800800
},
801801
'report-person-location-email': {
802802
validate: ['email', { type: 'maxlength', arguments: 100 }]
@@ -880,7 +880,7 @@ module.exports = {
880880
},
881881
'report-person-occupation-company-phone': {
882882
className: ['govuk-input', 'govuk-input--width-20'],
883-
validate: [{ type: 'maxlength', arguments: 20 }]
883+
validate: ['required', { type: 'maxlength', arguments: 20 }]
884884
},
885885
'report-person-occupation-company-manager': {
886886
mixin: 'input-text',
@@ -940,7 +940,7 @@ module.exports = {
940940
},
941941
'report-person-study-phone': {
942942
className: ['govuk-input', 'govuk-input--width-20'],
943-
validate: [{ type: 'maxlength', arguments: 20 }]
943+
validate: ['required', { type: 'maxlength', arguments: 20 }]
944944
},
945945
'report-person-study-email': {
946946
validate: ['email', { type: 'maxlength', arguments: 100 }]
@@ -1196,7 +1196,7 @@ module.exports = {
11961196
},
11971197
'company-phone': {
11981198
className: ['govuk-input', 'govuk-input--width-20'],
1199-
validate: [{ type: 'maxlength', arguments: 20 }]
1199+
validate: ['required', { type: 'maxlength', arguments: 20 }]
12001200
},
12011201
'company-email': {
12021202
formatter: ['removespaces'],

apps/paf/translations/src/en/validation.json

+13
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,19 @@
9393
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
9494
},
9595
"crime-location-phone": {
96+
"required": "Enter a valid phone number",
97+
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
98+
},
99+
100+
"report-person-study-phone": {
101+
"required": "Enter a valid phone number",
96102
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
97103
},
98104
"crime-another-location-address-postcode": {
99105
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
100106
},
101107
"crime-another-location-phone": {
108+
"required": "Enter a valid phone number",
102109
"maxlength": "You can't use more than {{maxlength}} numbers for your answer"
103110
},
104111
"report-person-first-name": {
@@ -130,6 +137,7 @@
130137
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
131138
},
132139
"report-person-location-phone": {
140+
"required": "Enter a valid phone number",
133141
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
134142
},
135143
"report-person-location-email": {
@@ -156,6 +164,11 @@
156164
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
157165
},
158166
"report-person-occupation-company-phone": {
167+
"required": "Enter a valid phone number",
168+
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
169+
},
170+
"company-phone": {
171+
"required": "Enter a valid phone number",
159172
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
160173
},
161174
"report-person-occupation-company-manager": {

0 commit comments

Comments
 (0)