Merged revisions 47609 via svnmerge from

svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq

........
  r47609 | ischommer | 2008-01-04 19:10:25 +1300 (Fri, 04 Jan 2008) | 1 line
  
  fixed validate() (wrong parameters)
........


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@52193 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-04-06 04:03:33 +00:00
parent 275e08bee1
commit caa59b2fce

View File

@ -69,7 +69,7 @@ JS;
return "\$('$formID').validateCurrency('$this->name');"; return "\$('$formID').validateCurrency('$this->name');";
} }
function validate() { function validate($validator) {
if(!empty ($this->value) && !preg_match('/^\$?(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $this->value)) { if(!empty ($this->value) && !preg_match('/^\$?(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $this->value)) {
$validator->validationError($this->name, _t('Form.VALIDCURRENCY', "Please enter a valid currency."), "validation", false); $validator->validationError($this->name, _t('Form.VALIDCURRENCY', "Please enter a valid currency."), "validation", false);
return false; return false;