From ca06f000a19968893b400da2cfbffd3dd240990e Mon Sep 17 00:00:00 2001 From: Luke Amos Date: Wed, 16 Jan 2019 23:32:15 +1300 Subject: [PATCH] FIX Fixes #850 added validation to numerical form fields --- code/Model/EditableFormField/EditableNumericField.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/Model/EditableFormField/EditableNumericField.php b/code/Model/EditableFormField/EditableNumericField.php index 9916db9..2190d12 100755 --- a/code/Model/EditableFormField/EditableNumericField.php +++ b/code/Model/EditableFormField/EditableNumericField.php @@ -82,4 +82,12 @@ class EditableNumericField extends EditableFormField $field->setAttribute('data-rule-max', $this->MaxValue); } } + public function validate() + { + $result = parent::validate(); + if ($this->MinValue > $this->MaxValue) { + $result->addError("Minimum length should be less than the Maximum length."); + } + return $result; + } }