99 * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
1010 */
1111import { defineFormConditional } from '@opencrvs/toolkit/conditionals'
12- import { field } from '@opencrvs/toolkit/events'
12+ import { and , field } from '@opencrvs/toolkit/events'
1313
1414export const MAX_NAME_LENGTH = 32
1515
@@ -20,11 +20,11 @@ export const invalidNameValidator = (fieldName: string) => ({
2020 description : 'This is the error message for invalid name' ,
2121 id : 'error.invalidName'
2222 } ,
23- validator : field ( fieldName ) . object ( {
24- firstname : field ( 'firstname' ) . isValidEnglishName ( ) ,
25- middlename : field ( 'middlename' ) . isValidEnglishName ( ) ,
26- surname : field ( 'surname' ) . isValidEnglishName ( )
27- } )
23+ validator : and (
24+ field ( fieldName ) . get ( 'firstname' ) . isValidEnglishName ( ) ,
25+ field ( fieldName ) . get ( 'middlename' ) . isValidEnglishName ( ) ,
26+ field ( fieldName ) . get ( 'surname' ) . isValidEnglishName ( )
27+ )
2828} )
2929
3030export const nationalIdValidator = ( fieldId : string ) => ( {
@@ -45,3 +45,11 @@ export const nationalIdValidator = (fieldId: string) => ({
4545 }
4646 } )
4747} )
48+
49+ export const farajalandNameConfig = {
50+ name : {
51+ firstname : { required : true } ,
52+ surname : { required : true }
53+ } ,
54+ maxLength : MAX_NAME_LENGTH
55+ }
0 commit comments