BUGFIX Fixed NumericField javascript validation to not fail on numbers with trailing or leading whitespace

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@74657 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-04-17 03:21:44 +00:00 committed by Sam Minnee
parent 03a66309d6
commit 6a51018f50

View File

@ -17,7 +17,7 @@ Behaviour.register({
el = _CURRENT_FORM.elements[fieldName]; el = _CURRENT_FORM.elements[fieldName];
if(!el || !el.value) return true; if(!el || !el.value) return true;
if(el.value.match(/^([0-9]+(\.[0-9]+)?$)/)) { if(el.value.match(/^\s*([0-9]+(\.[0-9]+)?\s*$)/)) {
return true; return true;
} else { } else {
validationError(el, "'" + el.value + "' $error","validation"); validationError(el, "'" + el.value + "' $error","validation");