Form: Preserve default if element has attribute 'disabled'

fixes #2509
This commit is contained in:
Noah Hilverling 2017-02-14 10:18:56 +01:00
parent d2341369a9
commit b0221c5e13
1 changed files with 5 additions and 4 deletions

View File

@ -1105,10 +1105,11 @@ class Form extends Zend_Form
*/
protected function preserveDefaults(Zend_Form $form, array & $defaults)
{
foreach ($form->getElements() as $name => $_) {
if (array_key_exists($name, $defaults)
&& array_key_exists($name . static::DEFAULT_SUFFIX, $defaults)
&& $defaults[$name] === $defaults[$name . static::DEFAULT_SUFFIX]
foreach ($form->getElements() as $name => $element) {
if ((array_key_exists($name, $defaults)
&& array_key_exists($name . static::DEFAULT_SUFFIX, $defaults)
&& $defaults[$name] === $defaults[$name . static::DEFAULT_SUFFIX])
|| $element->getAttrib('disabled')
) {
unset($defaults[$name]);
}