Skip to content

Commit 3c12071

Browse files
EscalationCondition.php: Set default operator value
For the `incident_age` column, the `operator` select is disabled and only offers a single option (`>`). Disabled HTML selects don't submit a value, so the operator was previously missing from the submitted data and form could not be submitted. Defaulting the element's value to the first available option ensures it's always set, even while disabled.
1 parent efb25c6 commit 3c12071

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

application/forms/EventRuleConfigElements/EscalationCondition.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
use ipl\Web\Filter\QueryString;
2020
use ipl\Web\Widget\Icon;
2121

22+
use function array_key_first;
23+
2224
/**
2325
* @phpstan-type ConditionData array{
2426
* column: string,
@@ -135,6 +137,7 @@ protected function assemble(): void
135137
$this->addElement('select', 'operator', [
136138
'required' => true,
137139
'options' => $operators,
140+
'value' => array_key_first($operators),
138141
'disabled' => $selectedColumn === 'incident_age'
139142
]);
140143

0 commit comments

Comments
 (0)