diff --git a/src/components/FormBuilder/FormBuilder.jsx b/src/components/FormBuilder/FormBuilder.jsx index 78e177b..472210e 100644 --- a/src/components/FormBuilder/FormBuilder.jsx +++ b/src/components/FormBuilder/FormBuilder.jsx @@ -847,6 +847,13 @@ const FormFieldSet = ({ const isFormInline = formInline && field?.type !== 'component' if (field) { const err = get(formik.touched, layout) && get(formik.errors, layout); + const errText = Array.isArray(err) ? Array.from(new Set(err)).join(', ') : err; + const isErrArrString = Array.isArray(err) ? err?.reduce((acc, curr) => { + return acc || (typeof curr === 'string' || curr instanceof String) + }, false): false; + + const isErrString = isErrArrString || (typeof err === 'string' || err instanceof String) + const growFactor = ((field.forceColumnWidth ?? 0) === 0) ? {} : { sm: field.forceColumnWidth } return ( {renderField(layout, field, fieldName)} - {!Array.isArray(err) ? err : ""} + {isErrString ? errText: ""} diff --git a/src/components/FormBuilder/index.stories.js b/src/components/FormBuilder/index.stories.js index 130531b..e3fd656 100644 --- a/src/components/FormBuilder/index.stories.js +++ b/src/components/FormBuilder/index.stories.js @@ -474,9 +474,9 @@ Duration.args = { duration: { type: "duration", label: "Duration", - initialValues: 60400, + initialValues: '', validator: () => - Yup.number().required().nullable() + Yup.number().required().label() }, }, formId: "duration",