Skip to content

Commit

Permalink
Merge pull request #225 from ukhsa-collaboration/OOC-4415/update-erro…
Browse files Browse the repository at this point in the history
…r-messages-to-defaults

OOC-4415/update error messages to defaults
  • Loading branch information
kathryn-dale authored Sep 12, 2024
2 parents f703d99 + 0fc1c41 commit ce2b852
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
18 changes: 15 additions & 3 deletions runner/src/server/forms/ReportAnOutbreak.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
"options": {
"customValidationMessages": {
"string.regex.base": "Enter a full UK postcode",
"string.pattern.base": "Enter a full UK postcode"
"string.pattern.base": "Enter a full UK postcode",
"string.empty": "Your setting postcode is required",
"string.base": "Your setting postcode is required"
},
"classes": "govuk-input--width-10"
},
Expand All @@ -51,7 +53,13 @@
},
{
"name": "S0Q3",
"options": { "required": true },
"options": {
"required": true,
"customValidationMessages": {
"string.empty": "Your local UKHSA health protection team is required",
"string.base": "Your local UKHSA health protection team is required"
}
},
"type": "SelectField",
"title": "Your local UKHSA health protection team",
"list": "sjgMDe",
Expand Down Expand Up @@ -157,7 +165,11 @@
{
"name": "S1Q7",
"options": {
"customValidationMessage": "Enter a telephone number, like 01632 960 001, 07700 900 982 or +44 808 157 0192"
"customValidationMessage": "Enter a telephone number, like 01632 960 001, 07700 900 982 or +44 808 157 0192",
"customValidationMessages":{
"string.base":"S1Q7. Telephone number/s of Key Contact Person is required",
"string.empty":"S1Q7. Telephone number/s of Key Contact Person is required"
}
},
"type": "TelephoneNumberField",
"title": "S1Q7. Telephone number/s of Key Contact Person",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import { ValidationOptions } from "joi";
* see @link https://joi.dev/api/?v=17.4.2#template-syntax for template syntax
*/
const messageTemplate = {
/* The commented out values are the XGov Forms default messages*/
// required: "Enter {{#label}}",
// selectRequired: "Select {{#label}}",
required: "{{#label}} is required",
selectRequired: "{{#label}} is required",
required: "Enter {{#label}}",
selectRequired: "Select {{#label}}",
max: "{{#label}} must be {{#limit}} characters or less",
min: "{{#label}} must be {{#limit}} characters or more",
regex: "enter a valid {{#label}}",
Expand Down

0 comments on commit ce2b852

Please sign in to comment.