Skip to content

Commit

Permalink
IBX-3067: Fixed JS validation for float and integer fieldtypes (#2056)
Browse files Browse the repository at this point in the history
  • Loading branch information
barw4 authored Jul 6, 2022
1 parent fc1838f commit 8a41e6e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down

0 comments on commit 8a41e6e

Please sign in to comment.