Merge pull request #4655 from Icinga/fix/duplicate-ids-in-html-3762
Fix duplicate ids in html
This commit is contained in:
commit
49ced694e7
|
@ -1085,7 +1085,7 @@ class Form extends Zend_Form
|
|||
return $this;
|
||||
}
|
||||
if ($this->getElement($this->tokenElementName) === null) {
|
||||
$this->addElement(new CsrfCounterMeasure($this->tokenElementName));
|
||||
$this->addElement('CsrfCounterMeasure', $this->tokenElementName);
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
|
|
|
@ -40,7 +40,7 @@ class CsrfCounterMeasure extends FormElement
|
|||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->addDecorator('ViewHelper');
|
||||
$this->setDecorators(['ViewHelper']);
|
||||
$this->setValue($this->generateCsrfToken());
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<li>
|
||||
<?php
|
||||
$removeAckForm = clone $removeAckForm;
|
||||
$removeAckForm->setName('quickAction_' . $removeAckForm->getName()); // Avoids id duplication
|
||||
$removeAckForm->setLabelEnabled(true);
|
||||
echo $removeAckForm;
|
||||
?>
|
||||
|
@ -42,6 +43,7 @@
|
|||
</li>
|
||||
<?php endif ?>
|
||||
<?php if (isset($checkNowForm)): // Form is unset if the current user lacks the respective permission ?>
|
||||
<?php ($checkNowForm = clone $checkNowForm)->setName('quickAction_' . $checkNowForm->getName()); // Avoids id duplication ?>
|
||||
<li><?= $checkNowForm ?></li>
|
||||
<?php endif ?>
|
||||
<?php if ($this->hasPermission('monitoring/command/comment/add')): ?>
|
||||
|
|
|
@ -373,8 +373,8 @@
|
|||
while (true) {
|
||||
var id = element.id;
|
||||
|
||||
// Ignore forms and form controls because id generation is unreliable :(
|
||||
if (id && ! element.form && ! (element instanceof HTMLFormElement)) {
|
||||
// Only use ids if they're truly unique
|
||||
if (!! id && document.querySelectorAll('* #' + id).length === 1) {
|
||||
path.push('#' + id);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue