Skip to content

Commit f8a2a6c

Browse files
committed
ap-6003 # Fixed validation
1 parent 5eac3c1 commit f8a2a6c

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/lib/forms-validation/common.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ export function validatePDFConfiguration({
138138
customPDFs,
139139
validatedFormElements,
140140
}: {
141-
pdfConfiguration: SubmissionEventTypes.PDFConfiguration | undefined
141+
pdfConfiguration:
142+
| SubmissionEventTypes.PDFConfiguration
143+
| SubmissionEventTypes.PDFConfiguration[]
144+
| undefined
142145
propertyName: string
143146
customPDFs: FormTypes.Form['customPDFs']
144147
validatedFormElements: FormTypes.FormElement[]
@@ -147,6 +150,19 @@ export function validatePDFConfiguration({
147150
return
148151
}
149152

153+
if (Array.isArray(pdfConfiguration)) {
154+
pdfConfiguration.forEach((pdfConfig, index) => {
155+
validatePDFConfiguration({
156+
pdfConfiguration: pdfConfig,
157+
propertyName: `${propertyName}[${index}]`,
158+
customPDFs,
159+
validatedFormElements,
160+
})
161+
})
162+
163+
return
164+
}
165+
150166
const customPdfId = pdfConfiguration.customPdfId
151167
if (customPdfId && !customPDFs?.some(({ id }) => id === customPdfId)) {
152168
throw new Error(

0 commit comments

Comments
 (0)