public function validate()
    {
        # addValues adds validation errors for unknown values
        $errs = count($this->errors);

        $dataKey = constant(get_called_class()."::EVENT_DATA_KEY");

        if ($this->beforeValidate() !== true) {
            return false;
        }
        foreach ($this->fields as $field) {
            if ($field->validate($this) === false) {
                foreach ($field->getErrors() as $error) {
                    $this->addError($error);
                    $errs++;
                }
            }
        }
        return (
            $errs > 0 ||
            $this->afterValidate() !== true ||
            count($this->errors) > 0
        ) ? false : true;
    }