From 65f64505b89153e5bea376b75d3d6b0b21d44fe4 Mon Sep 17 00:00:00 2001 From: Vossik Date: Fri, 24 Jul 2020 17:38:15 +0200 Subject: [PATCH 1/2] fixed MultiChoiceControl::setDisabled --- src/Form/TAjaxSelect.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Form/TAjaxSelect.php b/src/Form/TAjaxSelect.php index 69fd6f6..0c70408 100644 --- a/src/Form/TAjaxSelect.php +++ b/src/Form/TAjaxSelect.php @@ -138,6 +138,10 @@ private function initiateItems($value = null): void $value = $value ?? $this->value; $data = []; + if ($this instanceof \Nette\Forms\Controls\MultiChoiceControl) { + $this->value ??= []; + } + if (\in_array($value, [null, '', []], true)) { if (\count($this->items) > 0) { return; From 273826de2edb32bde03e9772b105b2f5067a2b9c Mon Sep 17 00:00:00 2001 From: Vossik Date: Fri, 24 Jul 2020 17:48:08 +0200 Subject: [PATCH 2/2] Moved MultiChoiceControl condition --- src/Form/TAjaxSelect.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Form/TAjaxSelect.php b/src/Form/TAjaxSelect.php index 0c70408..97ea3e5 100644 --- a/src/Form/TAjaxSelect.php +++ b/src/Form/TAjaxSelect.php @@ -135,13 +135,13 @@ private function getData(string $query = '', $default = null) : \Nepttune\Form\R private function initiateItems($value = null): void { - $value = $value ?? $this->value; - $data = []; - if ($this instanceof \Nette\Forms\Controls\MultiChoiceControl) { $this->value ??= []; } + $value = $value ?? $this->value; + $data = []; + if (\in_array($value, [null, '', []], true)) { if (\count($this->items) > 0) { return;