diff --git a/application/forms/DirectorDatafieldForm.php b/application/forms/DirectorDatafieldForm.php index 49521e3f..74c3b88b 100644 --- a/application/forms/DirectorDatafieldForm.php +++ b/application/forms/DirectorDatafieldForm.php @@ -32,17 +32,18 @@ class DirectorDatafieldForm extends DirectorObjectForm 'multiOptions' => $this->enumDataTypes(), 'class' => 'autosubmit' )); + } - $this->addElement('hidden', 'format', - array('decorators' => array('ViewHelper')) - ); - + public function onSuccess() + { if (isset($_POST['datatype'])) { $class = $_POST['datatype']; if ($class && array_key_exists($class, $this->enumDataTypes())) { - $this->getElement('format')->setValue($class::getFormat()); + $this->addHidden('format', $class::getFormat()); } } + + parent::onSuccess(); } protected function enumDataTypes()