From 4ba984f51266507299d2ce986f527438ebe4ff63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Thu, 6 Mar 2025 18:26:35 +0100 Subject: [PATCH] dropdown "set value" not needed --- src/Form/Control/Lookup.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Form/Control/Lookup.php b/src/Form/Control/Lookup.php index fdfcd45c86..ae13d44795 100644 --- a/src/Form/Control/Lookup.php +++ b/src/Form/Control/Lookup.php @@ -143,6 +143,14 @@ protected function init(): void }); } + #[\Override] + public function getValue() + { + return $this->entityField !== null + ? $this->getApp()->uiPersistence->typecastAttributeSaveField($this->entityField->getField(), $this->entityField->get()) + : ($this->content ?? ''); + } + /** * @param bool|string $when * @param JsExpressionable $action @@ -400,7 +408,7 @@ protected function renderView(): void $entity = $this->model->loadBy($idField, $this->entityField->get()); $row = $this->renderRow($entity); - $jsChain->dropdown('set value', $row['value'], true)->dropdown('set text', $row['title'], true); + $jsChain->dropdown('set text', $row['title'], true); } $this->js(true, $jsChain);