CurrencyField::jsValidation() needs to register its validateCurrency function mulitiple times with different FormID for working in a popup of ComplexTableField where FormID is changed.

In general all Form Fields should imply with this rule if a page contain mulitiple forms, but this is not under our current developing cycle, since our form fields validation is changing to use jQuery.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64896 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Normann Lou 2008-10-30 01:02:57 +00:00
parent 84db28eb10
commit 132f4ae5ca
2 changed files with 12 additions and 8 deletions

View File

@ -60,9 +60,11 @@ Behaviour.register({
});
JS;
Requirements::customScript($jsFunc, 'func_validateCurrency');
Requirements::customScript($jsFunc, 'func_validateCurrency_' .$formID);
return "\$('$formID').validateCurrency('$this->name');";
return <<<JS
if(\$('$formID')) \$('$formID').validateCurrency('$this->name');
JS;
}
function validate($validator) {

View File

@ -57,15 +57,17 @@ Behaviour.register({
}
});
JS;
Requirements :: customScript($jsFunc, 'func_validateDate');
Requirements :: customScript($jsFunc, 'func_validateDate_'.$formID);
// return "\$('$formID').validateDate('$this->name');";
return <<<JS
if(\$('$formID')){
if(typeof fromAnOnBlur != 'undefined'){
if(fromAnOnBlur.name == '$this->name')
$('$formID').validateDate('$this->name');
\$('$formID').validateDate('$this->name');
}else{
$('$formID').validateDate('$this->name');
\$('$formID').validateDate('$this->name');
}
}
JS;
}