mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: Validator::requiredField() should check the required field submitted value is an array before check strlen(). Some fields submitted as an array, e.g. MoneyField (from r109155)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112816 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
fcc20b5e1a
commit
a7d0b685ec
@ -167,7 +167,12 @@ abstract class Validator extends Object {
|
||||
}
|
||||
|
||||
function requireField($fieldName, $data) {
|
||||
if(!strlen($data[$fieldName])) $this->validationError($fieldName, "$fieldName is required.", "required");
|
||||
if(is_array($data[$fieldName]) && count($data[$fieldName])) {
|
||||
foreach($data[$fieldName] as $componentkey => $componentVal){
|
||||
if(!strlen($componentVal)) $this->validationError($fieldName, "$fieldName $componentkey is required.", "required");
|
||||
}
|
||||
|
||||
}else if(!strlen($data[$fieldName])) $this->validationError($fieldName, "$fieldName is required.", "required");
|
||||
}
|
||||
|
||||
function includeJavascriptValidation() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user