function Check($data) { $success = true; foreach ($this->fields as $name => $field) { if ($field instanceof FormInterfaces\IFormField) { $value = isset($data[$name]) ? $data[$name] : ''; $success = $field->Check($value) && $success; } else { if ($field instanceof FormInterfaces\IFormElement) { $success = $field->Check($data) && $success; } } } if ($success) { $this->hasCollectionErrors = !parent::Check($data); } $this->checkFailed = !$success || $this->hasCollectionErrors; return !$this->checkFailed; }
/** * Searches and returns a required validator * @return Validation\Required */ function Check($value) { $this->SetValue($value); $required = $this->GetRequiredValidator(); if ($required && !$required->Check($value)) { $this->checkFailed = true; return false; } return parent::Check($value); }