Index: kernel/db/db_event_handler.php =================================================================== --- kernel/db/db_event_handler.php (revision 12677) +++ kernel/db/db_event_handler.php (working copy) @@ -1846,6 +1846,16 @@ } /** + * Occurs before validation attempt + * + * @param kEvent $event + */ + function OnBeforeItemValidate(&$event) + { + + } + + /** * Occurs after successful item validation * * @param kEvent $event Index: kernel/db/dbitem.php =================================================================== --- kernel/db/dbitem.php (revision 12677) +++ kernel/db/dbitem.php (working copy) @@ -472,10 +472,6 @@ return false; } - if (!$this->raiseEvent('OnAfterItemValidate')) { - return false; - } - if (!$this->FieldValues) { // nothing to update return true; @@ -561,6 +557,9 @@ return true; } + // will apply any custom validation to the item + $this->raiseEvent('OnBeforeItemValidate'); + $global_res = true; foreach ($this->Fields as $field => $params) { $res = $this->ValidateField($field); @@ -577,6 +576,11 @@ $this->Application->Debugger->dumpVars($this->FieldErrors); } + if ($global_res) { + // no validation errors + $this->raiseEvent('OnAfterItemValidate'); + } + return $global_res; } @@ -822,10 +826,6 @@ return false; } - if (!$this->raiseEvent('OnAfterItemValidate')) { - return false; - } - if (is_int($force_id)) { $this->FieldValues[$this->IDField] = $force_id; }