From af829e82d39a5127102599b22a40759602ae2b9e Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@enhancesoft.com> Date: Tue, 11 Sep 2018 17:51:20 +0000 Subject: [PATCH] Add NumericField --- include/class.forms.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/include/class.forms.php b/include/class.forms.php index d87d9501c..11419d2f8 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -1960,6 +1960,40 @@ class ChoiceField extends FormField { } } +class NumericField extends FormField { + + function getSearchMethods() { + return array( + 'equal' => __('Equal'), + 'greater' => __('Greater Than'), + 'less' => __('Less Than'), + ); + } + + function getSearchMethodWidgets() { + return array( + 'equal' => array('TextboxField', array( + 'configuration' => array( + 'validator' => 'number', + 'size' => 6 + ), + )), + 'greater' => array('TextboxField', array( + 'configuration' => array( + 'validator' => 'number', + 'size' => 6 + ), + )), + 'less' => array('TextboxField', array( + 'configuration' => array( + 'validator' => 'number', + 'size' => 6 + ), + )), + ); + } +} + class DatetimeField extends FormField { static $widget = 'DatetimePickerWidget'; -- GitLab