diff --git a/src/Fields/Base/NumericField.php b/src/Fields/Base/NumericField.php
index 3014b7a..9213c4b 100644
--- a/src/Fields/Base/NumericField.php
+++ b/src/Fields/Base/NumericField.php
@@ -32,15 +32,15 @@ public function renderInput(InputRenderer $renderer, InputModel $model, array $a
{
$defaults = [];
- if ($this->max_length) {
+ if ($this->max_length !== null) {
$defaults['maxlength'] = $this->max_length;
}
- if ($this->min_value) {
+ if ($this->min_value !== null) {
$defaults['min'] = $this->min_value;
}
- if ($this->max_value) {
+ if ($this->max_value !== null) {
$defaults['max'] = $this->max_value;
}
diff --git a/tests/unit/FieldRenderCest.php b/tests/unit/FieldRenderCest.php
index 3321ca5..b548978 100644
--- a/tests/unit/FieldRenderCest.php
+++ b/tests/unit/FieldRenderCest.php
@@ -8,7 +8,6 @@
use mindplay\kissform\Fields\EmailField;
use mindplay\kissform\Fields\FloatField;
use mindplay\kissform\Fields\HiddenField;
-use mindplay\kissform\Fields\InlineRadioGroup;
use mindplay\kissform\Fields\IntField;
use mindplay\kissform\Fields\PasswordField;
use mindplay\kissform\Fields\RadioGroup;
@@ -214,6 +213,12 @@ public function renderIntField(UnitTester $I)
$field->max_value = 99;
$I->assertSame('', $form->render($field));
+
+ $field->min_value = 0;
+ $field->max_value = 0;
+ $field->max_length = 0;
+
+ $I->assertSame('', $form->render($field));
}
public function renderFloatField(UnitTester $I)
@@ -232,6 +237,12 @@ public function renderFloatField(UnitTester $I)
$field->max_value = 99;
$I->assertSame('', $form->render($field));
+
+ $field->min_value = 0;
+ $field->max_value = 0;
+ $field->max_length = 0;
+
+ $I->assertSame('', $form->render($field));
}
public function renderDateTimeField(UnitTester $I)