Skip to content

Commit 9b28874

Browse files
Apply error messages to CheckboxesField (#369)
1 parent 2ac494a commit 9b28874

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/server/plugins/engine/components/CheckboxesField.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ export class CheckboxesField extends SelectionControlField {
4141
.single()
4242
.label(this.label)
4343
.required()
44+
.messages({
45+
'array.min': 'Select at least {{#limit}} options from the list',
46+
'array.max': 'Only {{#limit}} can be selected from the list',
47+
'array.length': 'Select only {{#limit}} options from the list'
48+
})
4449

4550
if (options.required === false) {
4651
formSchema = formSchema.optional()

src/server/plugins/engine/pageControllers/validationOptions.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ export const messageTemplate: Record<string, JoiExpression> = {
6161
) as JoiExpression,
6262
dateFormat: '{{#title}} must be a real date',
6363
dateMin: '{{#title}} must be the same as or after {{#limit}}',
64-
dateMax: '{{#title}} must be the same as or before {{#limit}}',
65-
arrayMax: 'Only {{#limit}} can be selected from the list',
66-
arrayMin: 'Select at least {{#limit}} options from the list',
67-
arrayLength: 'Select only {{#limit}} options from the list'
64+
dateMax: '{{#title}} must be the same as or before {{#limit}}'
6865
}
6966

7067
export const messages: LanguageMessagesExt = {

0 commit comments

Comments
 (0)