diff --git a/packages/chakra-components/src/components/Election/Questions.tsx b/packages/chakra-components/src/components/Election/Questions.tsx index d6ebc74e..bdcc5d76 100644 --- a/packages/chakra-components/src/components/Election/Questions.tsx +++ b/packages/chakra-components/src/components/Election/Questions.tsx @@ -169,7 +169,7 @@ const QuestionField = ({ question, index }: QuestionFieldProps) => { )} ( { const required = { value: true, - message: localize('required'), + message: localize('validation.required'), + } + const minLength = { + value: 8, + message: localize('validation.min_length', { min: 8 }), } if (election?.get('census.type') !== 'spreadsheet' || election instanceof ArchivedElection) return null @@ -116,7 +120,7 @@ export const SpreadsheetAccess = (rest: ChakraProps) => { {election.electionType.anonymous && ( {localize('spreadsheet.anon_sik_label')} - + {!!errors.sik_password ? ( {errors.sik_password?.message?.toString()} ) : ( diff --git a/packages/chakra-components/src/i18n/locales.ts b/packages/chakra-components/src/i18n/locales.ts index 9b48b2c8..0f35d20b 100644 --- a/packages/chakra-components/src/i18n/locales.ts +++ b/packages/chakra-components/src/i18n/locales.ts @@ -35,7 +35,6 @@ export const locales = { wrong_data_title: 'Wrong data', wrong_data_description: 'The specified data is not correct', }, - required: 'This field is required', schedule: 'Voting from {{ begin }} to {{ end }}', // results component results: { @@ -63,6 +62,10 @@ export const locales = { logout: 'Logout', modal_title: 'You must identify first', }, + validation: { + required: 'This field is required', + min_length: 'This field must be at least {{ min }} characters long', + }, } export type Locale = RecursivePartial