mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
FIX Fixes #850 added validation to numerical form fields
This commit is contained in:
parent
2cb649abbb
commit
ca06f000a1
@ -82,4 +82,12 @@ class EditableNumericField extends EditableFormField
|
|||||||
$field->setAttribute('data-rule-max', $this->MaxValue);
|
$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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user