Initialize all empty ellements with their default values.

refs #6098
This commit is contained in:
Matthias Jentsch 2014-05-12 15:49:38 +02:00
parent 793a0a061f
commit ced6e8f78f
1 changed files with 10 additions and 0 deletions

View File

@ -163,6 +163,16 @@ class LoggingForm extends Form
$this->setSubmitLabel('{{SAVE_ICON}} Save Changes');
}
public function isValid($data) {
foreach ($this->getElements() as $key => $element) {
// Initialize all empty elements with their default values.
if (!isset($data[$key])) {
$data[$key] = $element->getValue();
}
}
return parent::isValid($data);
}
/**
* Return a Zend_Config object containing the state defined in this form
*