From f3e74f0f24fa6973c20f62007ae09233098c72d0 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 1 Sep 2014 09:44:04 +0200 Subject: [PATCH 1/2] library/form: Append class 'autosubmit' in case the element to autosubmit has the class attribute set Before, the class attribute would've been overwritten. refs #5525 --- library/Icinga/Web/Form.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php index f47a42d9a..f4acaa5f1 100644 --- a/library/Icinga/Web/Form.php +++ b/library/Icinga/Web/Form.php @@ -370,7 +370,15 @@ class Form extends Zend_Form if ($el->getAttrib('autosubmit')) { // Need to add this decorator first or it interferes with the other's two HTML otherwise $el->addDecorator(new NoScriptApply()); // Non-JS environments - $el->setAttrib('class', 'autosubmit'); // JS environments + $class = $el->getAttrib('class'); + if (is_array($class)) { + $class[] = 'autosubmit'; + } elseif ($class === null) { + $class = 'autosubmit'; + } else { + $class .= ' autosubmit'; + } + $el->setAttrib('class', $class); // JS environments unset($el->autosubmit); } From 0822aff2930c876ab4f5b18508888f41adcbb26e Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 1 Sep 2014 14:40:45 +0200 Subject: [PATCH 2/2] library/form: Fix return value of `getName()' not being filterd the first time it's called `Form::getName()' auto-detects the form's name if it's not set and sets the form's name using `Zend_Form::setName()'. `Zend_Form::setName()' then filters the form name stripping backslash '\' characters. The first call to `Form::getName()' did not regard the filtering and thus returned the unfiltered name which led to `Form::wasSent()' returning `false'. refs #5525 --- library/Icinga/Web/Form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php index f4acaa5f1..8b0aef091 100644 --- a/library/Icinga/Web/Form.php +++ b/library/Icinga/Web/Form.php @@ -585,8 +585,8 @@ class Form extends Zend_Form if (! $name) { $name = get_class($this); $this->setName($name); + $name = parent::getName(); } - return $name; }