diff --git a/library/Director/Web/Form/DirectorObjectForm.php b/library/Director/Web/Form/DirectorObjectForm.php index 3d7bf976..d5949d69 100644 --- a/library/Director/Web/Form/DirectorObjectForm.php +++ b/library/Director/Web/Form/DirectorObjectForm.php @@ -96,6 +96,9 @@ abstract class DirectorObjectForm extends QuickForm $this->addHidden('id'); } $this->setDefaults($this->object->getProperties()); + if (! $this->hasBeenSubmitted()) { + $this->beforeValidation($this->object->getProperties()); + } return $this; } diff --git a/library/Director/Web/Form/QuickForm.php b/library/Director/Web/Form/QuickForm.php index 1e92fc73..5069dca3 100644 --- a/library/Director/Web/Form/QuickForm.php +++ b/library/Director/Web/Form/QuickForm.php @@ -112,6 +112,10 @@ abstract class QuickForm extends Zend_Form return $this->hasBeenSent(); } + protected function beforeValidation($data = array()) + { + } + public function handleRequest(Request $request = null) { if ($request !== null) { @@ -121,6 +125,7 @@ abstract class QuickForm extends Zend_Form if ($this->hasBeenSent()) { $post = $this->getRequest()->getPost(); if ($this->hasBeenSubmitted()) { + $this->beforeValidation($post); if ($this->isValid($post)) { $this->onSuccess(); } else {