diff --git a/src/components/Geometry/GeometryAttributePicker.js b/src/components/Geometry/GeometryAttributePicker.js index 595037aa9..1404daabf 100644 --- a/src/components/Geometry/GeometryAttributePicker.js +++ b/src/components/Geometry/GeometryAttributePicker.js @@ -27,6 +27,9 @@ const VALIDATOR = (selectedAttributes = []) => ? i18n.t('One attribute must be selected') : undefined +const getValidator = (useAttribute) => + useAttribute ? VALIDATOR : Function.prototype + const HELPTEXT = i18n.t( 'Associated geometry import requires an attribute of type "GeoJSON" applied to "Organisation unit". It can be defined in the Maintenance app.' ) @@ -66,7 +69,7 @@ const GeometryAttributePicker = ({ selectedLabel={SELECTEDLABEL} dataTest={DATATEST} multiSelect={multiSelect} - validator={VALIDATOR} + validator={getValidator(useAttribute)} autoSelectFirst {...rest} />