BUGFIX If RequiredFields::php() is given any fieldName that is NULL, don't attempt to validate a NULL field.

This commit is contained in:
Sean Harvey 2012-05-29 14:37:26 +12:00
parent dbbabe129b
commit d7a8fa9266

View File

@ -66,6 +66,8 @@ class RequiredFields extends Validator {
}
if($this->required) {
foreach($this->required as $fieldName) {
if(!$fieldName) continue;
$formField = $fields->dataFieldByName($fieldName);
$error = true;
@ -74,8 +76,7 @@ class RequiredFields extends Validator {
if(is_array($value)) {
if ($formField instanceof FileField && isset($value['error']) && $value['error']) {
$error = true;
}
else {
} else {
$error = (count($value)) ? false : true;
}
} else {
@ -96,7 +97,6 @@ class RequiredFields extends Validator {
$valid = false;
}
}
}
return $valid;