diff --git a/src/pages/dataElements/fields/CustomAttributes.tsx b/src/pages/dataElements/fields/CustomAttributes.tsx index 92539a68..780971e9 100644 --- a/src/pages/dataElements/fields/CustomAttributes.tsx +++ b/src/pages/dataElements/fields/CustomAttributes.tsx @@ -21,6 +21,9 @@ type CustomAttributeProps = { function CustomAttribute({ attribute, index }: CustomAttributeProps) { const name = `attributeValues[${index}].value` const required = attribute.mandatory + // If we don't do this, then RFF will set this value to undefined instead + // of an empty string + const parse = (value: string) => value || '' if (attribute.optionSet?.options) { const options = attribute.optionSet?.options.map( @@ -43,6 +46,7 @@ function CustomAttribute({ attribute, index }: CustomAttributeProps) { label={attribute.displayFormName} name={name} options={options} + parse={parse} /> ) @@ -57,6 +61,7 @@ function CustomAttribute({ attribute, index }: CustomAttributeProps) { inputWidth={inputWidth} label={attribute.displayFormName} name={name} + parse={parse} /> ) @@ -71,6 +76,7 @@ function CustomAttribute({ attribute, index }: CustomAttributeProps) { inputWidth={inputWidth} label={attribute.displayFormName} name={name} + parse={parse} /> )