File tree Expand file tree Collapse file tree
apps/web/src/modules/FormBuilder Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ export const errorMessage = {
44 [ QuestionTypes . shortAnswer ] : {
55 required : "Required" ,
66 tooLong : "Value is too long" ,
7+ tooShort : "Value is too short" ,
78 } ,
89
910 [ QuestionTypes . paragraph ] : {
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export const ShortAnswerQuestion = createQuestionItem({
1616 regex : z . string ( ) . optional ( ) ,
1717 validation : z
1818 . object ( {
19+ minLength : z . number ( ) ,
1920 maxLength : z . number ( ) ,
2021 email : z . boolean ( ) ,
2122 } )
@@ -53,13 +54,21 @@ export const ShortAnswerQuestion = createQuestionItem({
5354 ) ;
5455 }
5556
57+ if ( typeof validation . minLength === "number" ) {
58+ schema = schema . min ( validation . minLength , error . tooShort ) ;
59+ }
60+
5661 if ( typeof validation . maxLength === "number" ) {
5762 schema = schema . max ( validation . maxLength , error . tooLong ) ;
5863 }
5964
6065 return schema ;
6166 }
6267
68+ if ( typeof validation . minLength === "number" ) {
69+ schema = schema . min ( validation . minLength , error . tooShort ) ;
70+ }
71+
6372 if ( typeof validation . maxLength === "number" ) {
6473 schema = schema . max ( validation . maxLength , error . tooLong ) ;
6574 }
You can’t perform that action at this time.
0 commit comments