Permalink
Browse files

BUGFIX NumericField javascript does not accept negatives, make use of…

… isNaN built-in javascript function instead of custom regex (from r108633)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112760 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent b7f2130 commit 4b1f71d67b1ff094805a5cdbcb1c1463498c5ee2 @sminnee sminnee committed Oct 19, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 forms/NumericField.php
View
@@ -20,11 +20,11 @@ function jsValidation() {
$jsFunc =<<<JS
Behaviour.register({
"#$formID": {
- validateNumericField: function(fieldName) {
+ validateNumericField: function(fieldName) {
el = _CURRENT_FORM.elements[fieldName];
if(!el || !el.value) return true;
- if(el.value.match(/^\s*(\-?[0-9]+(\.[0-9]+)?\s*$)/)) {
+ if(!isNaN(el.value)) {
return true;
} else {
validationError(el, "'" + el.value + "' $error","validation");

0 comments on commit 4b1f71d

Please sign in to comment.