Permalink
Browse files

BUGFIX Fixed NumericField->jsValidation(), now accepts negative numbe…

…rs, making it more like the equivalent phpValidation(), which is using is_numeric() (see #4874, thanks Allisone) (from r97482)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102497 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 792deb3 commit 051878c6a45ce73c44156af9f55772ed56eec2d6 @chillu chillu committed Apr 12, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 forms/NumericField.php
View
@@ -24,7 +24,7 @@ function jsValidation() {
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");

0 comments on commit 051878c

Please sign in to comment.