Skip to content

Commit

Permalink
♿ [#4719] Added expected postcode format to error message
Browse files Browse the repository at this point in the history
  • Loading branch information
robinmolen committed Oct 22, 2024
1 parent 12a4c89 commit 4bc98d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/openforms/js/components/formio_builder/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,18 @@ const getBuilderOptions = () => {
input: true,
inputMask: '9999 AA',
validateOn: 'blur',
// The validate config doesn't seem to be used. Its also missing in the form definition BD
validate: {
customMessage: 'Invalid Postcode',
// Dutch postcode has 4 numbers and 2 letters (case insensitive). Letter combinations SS, SD and SA
// are not used due to the Nazi-association.
// See https://stackoverflow.com/a/17898538/7146757 and https://nl.wikipedia.org/wiki/Postcodes_in_Nederland
pattern: '^[1-9][0-9]{3} ?(?!sa|sd|ss|SA|SD|SS)[a-zA-Z]{2}$',
},
// This is needed to show the 'Invalid Postcode' error message on mask errors
errors: {
mask: 'Invalid Postcode',
},
},
},
email: {
Expand Down
1 change: 1 addition & 0 deletions src/openforms/js/lang/formio/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@
"{{ labels }} or {{ lastLabel }}": "{{ labels }} or {{ lastLabel }}",
"invalid_time": "Only times between {{ minTime }} and {{ maxTime }} are allowed.",
"You must select at least {{minCount}} items.": "Ensure this field has at least {{minCount}} checked options.",
"Invalid Postcode": "The submitted value does not match the postcode pattern: 1234 AB",
"": ""
}
2 changes: 1 addition & 1 deletion src/openforms/js/lang/formio/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@
"Form fields": "Formuliervelden",
"Presets": "Voorgedefinieerd",
"Deprecated": "Verouderd",
"Invalid Postcode": "Ongeldige Postcode",
"Invalid Postcode": "De opgegeven waarde voldoet niet aan het postcode formaat: 1234 AB",
"Clear on hide": "Wissen als veld verborgen is",
"Remove the value of this field from the submission if it is hidden. Note: the value of this field is then also not used in logic rules!": "Verwijder de waarde van dit veld van de inzending als dit veld verborgen is. Let op: De waarde van dit veld wordt dan ook niet gebruikt in logica regels!",
"Column sizes": "Grootte van de kolommen",
Expand Down

0 comments on commit 4bc98d6

Please sign in to comment.