diff --git a/src/pages/dataElements/form/CustomAttributes.tsx b/src/pages/dataElements/form/CustomAttributes.tsx index fb67856a..f379ffd5 100644 --- a/src/pages/dataElements/form/CustomAttributes.tsx +++ b/src/pages/dataElements/form/CustomAttributes.tsx @@ -14,25 +14,25 @@ type CustomAttributeProps = { function CustomAttribute({ attribute, index }: CustomAttributeProps) { const name = `attributeValues[${index}].value` + const required = attribute.mandatory if (attribute.optionSet?.options) { - const attributeOptions = attribute.optionSet?.options.map( + const options = attribute.optionSet?.options.map( ({ code, displayName }) => ({ value: code, label: displayName, }) ) - const options = [ - { value: '', label: i18n.t('') }, - ...(attributeOptions || []), - ] + if (required) { + options.unshift({ value: '', label: i18n.t('') }) + } return (