From e9bcbd7cc7de908959720ac691b971d0c924c500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Pel=C3=AD=C5=A1ek?= Date: Fri, 14 Jun 2019 01:07:17 +0200 Subject: [PATCH] Update TAjaxSelect.php --- src/Form/TAjaxSelect.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Form/TAjaxSelect.php b/src/Form/TAjaxSelect.php index 3cb59fd..64c4fb2 100644 --- a/src/Form/TAjaxSelect.php +++ b/src/Form/TAjaxSelect.php @@ -53,13 +53,17 @@ public function getControl(): \Nette\Utils\Html $attrs = []; $control = parent::getControl(); - $attrs['data-ajaxselect'] = $this->getForm()->getPresenter()->link( - $this->lookupPath(Presenter::class) . IComponent::NAME_SEPARATOR . self::CALLBACK_SIGNAL_NAME . '!' - ); + if ($this->callback) { + $attrs['data-ajaxselect'] = $this->getForm()->getPresenter()->link( + $this->lookupPath(Presenter::class) . IComponent::NAME_SEPARATOR . self::CALLBACK_SIGNAL_NAME . '!' + ); + } - $attrs['data-onchange'] = $this->getForm()->getPresenter()->link( - $this->lookupPath(Presenter::class) . IComponent::NAME_SEPARATOR . self::ONCHANGE_SIGNAL_NAME . '!' - ); + if ($this->onchange) { + $attrs['data-onchange'] = $this->getForm()->getPresenter()->link( + $this->lookupPath(Presenter::class) . IComponent::NAME_SEPARATOR . self::ONCHANGE_SIGNAL_NAME . '!' + ); + } $control->addAttributes($attrs); return $control;