Skip to content

Commit e9bcbd7

Browse files
authored
Update TAjaxSelect.php
1 parent bfe24b4 commit e9bcbd7

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/Form/TAjaxSelect.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,17 @@ public function getControl(): \Nette\Utils\Html
5353
$attrs = [];
5454
$control = parent::getControl();
5555

56-
$attrs['data-ajaxselect'] = $this->getForm()->getPresenter()->link(
57-
$this->lookupPath(Presenter::class) . IComponent::NAME_SEPARATOR . self::CALLBACK_SIGNAL_NAME . '!'
58-
);
56+
if ($this->callback) {
57+
$attrs['data-ajaxselect'] = $this->getForm()->getPresenter()->link(
58+
$this->lookupPath(Presenter::class) . IComponent::NAME_SEPARATOR . self::CALLBACK_SIGNAL_NAME . '!'
59+
);
60+
}
5961

60-
$attrs['data-onchange'] = $this->getForm()->getPresenter()->link(
61-
$this->lookupPath(Presenter::class) . IComponent::NAME_SEPARATOR . self::ONCHANGE_SIGNAL_NAME . '!'
62-
);
62+
if ($this->onchange) {
63+
$attrs['data-onchange'] = $this->getForm()->getPresenter()->link(
64+
$this->lookupPath(Presenter::class) . IComponent::NAME_SEPARATOR . self::ONCHANGE_SIGNAL_NAME . '!'
65+
);
66+
}
6367

6468
$control->addAttributes($attrs);
6569
return $control;

0 commit comments

Comments
 (0)