Skip to content

Commit

Permalink
Added validation for phone textbox
Browse files Browse the repository at this point in the history
  • Loading branch information
TemitopeAyokuHO committed Dec 28, 2023
1 parent 10b21c1 commit 7eec005
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
12 changes: 6 additions & 6 deletions apps/paf/fields/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ module.exports = {
},
'crime-location-phone': {
className: ['govuk-input', 'govuk-input--width-20'],
validate: [{ type: 'maxlength', arguments: 20 }]
validate: ['required', { type: 'maxlength', arguments: 20 }]
},
'crime-another-location': {
isPageHeading: true,
Expand Down Expand Up @@ -646,7 +646,7 @@ module.exports = {
},
'crime-another-location-phone': {
className: ['govuk-input', 'govuk-input--width-20'],
validate: [{ type: 'maxlength', arguments: 20 }]
validate: ['required', { type: 'maxlength', arguments: 20 }]
},
'report-person': {
mixin: 'radio-group',
Expand Down Expand Up @@ -796,7 +796,7 @@ module.exports = {
},
'report-person-location-phone': {
className: ['govuk-input', 'govuk-input--width-20'],
validate: [{ type: 'maxlength', arguments: 20 }]
validate: ['required', { type: 'maxlength', arguments: 20 }]
},
'report-person-location-email': {
validate: ['email', { type: 'maxlength', arguments: 100 }]
Expand Down Expand Up @@ -880,7 +880,7 @@ module.exports = {
},
'report-person-occupation-company-phone': {
className: ['govuk-input', 'govuk-input--width-20'],
validate: [{ type: 'maxlength', arguments: 20 }]
validate: ['required', { type: 'maxlength', arguments: 20 }]
},
'report-person-occupation-company-manager': {
mixin: 'input-text',
Expand Down Expand Up @@ -940,7 +940,7 @@ module.exports = {
},
'report-person-study-phone': {
className: ['govuk-input', 'govuk-input--width-20'],
validate: [{ type: 'maxlength', arguments: 20 }]
validate: ['required', { type: 'maxlength', arguments: 20 }]
},
'report-person-study-email': {
validate: ['email', { type: 'maxlength', arguments: 100 }]
Expand Down Expand Up @@ -1196,7 +1196,7 @@ module.exports = {
},
'company-phone': {
className: ['govuk-input', 'govuk-input--width-20'],
validate: [{ type: 'maxlength', arguments: 20 }]
validate: ['required', { type: 'maxlength', arguments: 20 }]
},
'company-email': {
formatter: ['removespaces'],
Expand Down
13 changes: 13 additions & 0 deletions apps/paf/translations/src/en/validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,19 @@
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
},
"crime-location-phone": {
"required": "Enter a valid phone number",
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
},

"report-person-study-phone": {
"required": "Enter a valid phone number",
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
},
"crime-another-location-address-postcode": {
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
},
"crime-another-location-phone": {
"required": "Enter a valid phone number",
"maxlength": "You can't use more than {{maxlength}} numbers for your answer"
},
"report-person-first-name": {
Expand Down Expand Up @@ -130,6 +137,7 @@
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
},
"report-person-location-phone": {
"required": "Enter a valid phone number",
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
},
"report-person-location-email": {
Expand All @@ -156,6 +164,11 @@
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
},
"report-person-occupation-company-phone": {
"required": "Enter a valid phone number",
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
},
"company-phone": {
"required": "Enter a valid phone number",
"maxlength": "You can't use more than {{maxlength}} characters for your answer"
},
"report-person-occupation-company-manager": {
Expand Down

0 comments on commit 7eec005

Please sign in to comment.