From 1216340a464bcbbd6285c54e2c3bfcbf27c2e351 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Sun, 14 Jan 2024 11:54:25 -0500 Subject: [PATCH] Update to previous commit --- .../Inputfield/InputfieldInteger.module | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/wire/modules/Inputfield/InputfieldInteger.module b/wire/modules/Inputfield/InputfieldInteger.module index 8b825ab8..ab97fb20 100644 --- a/wire/modules/Inputfield/InputfieldInteger.module +++ b/wire/modules/Inputfield/InputfieldInteger.module @@ -160,16 +160,14 @@ class InputfieldInteger extends Inputfield { if($key === 'value') { $value = $this->sanitizeValue($value); if(strlen("$value") && !$this->isInRange($value)) { - if($value) { - // apply the following only for non-zero values - $min = (string) $this->attr('min'); - $max = (string) $this->attr('max'); - $any = $this->_('any'); // referring to “any” minimum or maximum number - if(!strlen("$min")) $min = $any; - if(!strlen("$max")) $max = $any; - $this->error(sprintf($this->_('Specified value %3$s removed because it is out of bounds (min=%1$s, max=%2$s)'), $min, $max, $value)); - } - $value = $this->val(); // restore previous value + // apply the following only for non-zero values + $min = (string) $this->attr('min'); + $max = (string) $this->attr('max'); + $any = $this->_('any'); // referring to “any” minimum or maximum number + if(!strlen("$min")) $min = $any; + if(!strlen("$max")) $max = $any; + $this->error(sprintf($this->_('Specified value %3$s removed because it is out of bounds (min=%1$s, max=%2$s)'), $min, $max, $value)); + $value = $this->val(); } } else if($key === 'min' || $key === 'max') { if(strlen("$value")) {