mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX NumericField javascript does not accept negatives, make use of isNaN built-in javascript function instead of custom regex
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@108633 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
ddcb7b6b89
commit
c738b4137b
@ -20,11 +20,11 @@ class NumericField extends TextField{
|
||||
$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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user