From 0d79696883b5239efda8b773b98b41e018caff59 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 25 Jan 2010 07:57:35 +0000 Subject: [PATCH] BUGFIX Fixed NumericField->jsValidation(), now accepts negative numbers, making it more like the equivalent phpValidation(), which is using is_numeric() (see #4874, thanks Allisone) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@97482 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/NumericField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms/NumericField.php b/forms/NumericField.php index c113863ef..768bf435e 100755 --- a/forms/NumericField.php +++ b/forms/NumericField.php @@ -24,7 +24,7 @@ Behaviour.register({ el = _CURRENT_FORM.elements[fieldName]; if(!el || !el.value) return true; - if(el.value.match(/^\s*([0-9]+(\.[0-9]+)?\s*$)/)) { + if(el.value.match(/^\s*(\-?[0-9]+(\.[0-9]+)?\s*$)/)) { return true; } else { validationError(el, "'" + el.value + "' $error","validation");