diff --git a/src/bundle/Resources/public/js/scripts/fieldType/ezfloat.js b/src/bundle/Resources/public/js/scripts/fieldType/ezfloat.js index be713813bf..198fc47720 100644 --- a/src/bundle/Resources/public/js/scripts/fieldType/ezfloat.js +++ b/src/bundle/Resources/public/js/scripts/fieldType/ezfloat.js @@ -18,7 +18,7 @@ const isFloat = Number.isInteger(value) || value % 1 !== 0; const isLess = value < parseFloat(event.target.getAttribute('min')); const isGreater = value > parseFloat(event.target.getAttribute('max')); - const isError = (isEmpty && isRequired) || !isFloat || isLess || isGreater; + const isError = (isEmpty && isRequired) || (!isEmpty && (!isFloat || isLess || isGreater)); const label = event.target.closest(SELECTOR_FIELD).querySelector('.ez-field-edit__label').innerHTML; const result = { isError }; diff --git a/src/bundle/Resources/public/js/scripts/fieldType/ezinteger.js b/src/bundle/Resources/public/js/scripts/fieldType/ezinteger.js index fd8a7d5682..e7e08f744b 100644 --- a/src/bundle/Resources/public/js/scripts/fieldType/ezinteger.js +++ b/src/bundle/Resources/public/js/scripts/fieldType/ezinteger.js @@ -18,7 +18,7 @@ const isInteger = Number.isInteger(value); const isLess = value < parseInt(event.target.getAttribute('min'), 10); const isGreater = value > parseInt(event.target.getAttribute('max'), 10); - const isError = (isEmpty && isRequired) || !isInteger || isLess || isGreater; + const isError = (isEmpty && isRequired) || (!isEmpty && (!isInteger || isLess || isGreater)); const label = event.target.closest(SELECTOR_FIELD).querySelector('.ez-field-edit__label').innerHTML; const result = { isError };