diff --git a/src/bundle/Resources/public/js/scripts/fieldType/ezfloat.js b/src/bundle/Resources/public/js/scripts/fieldType/ezfloat.js index a8ccb2c0fb..11d66b6b00 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('.ibexa-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 cc633ed5ba..9971c38cfe 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('.ibexa-field-edit__label').innerHTML; const result = { isError };