diff --git a/composer.json b/composer.json index 689a7b9..6ffe24b 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "foowie/dependentselectbox", + "name": "oparizek/dependentselectbox", "type": "library", "description": "Selectbox whose options are depended on another selectbox. Library for Nette Framework", "keywords": ["nette", "selectbox"], diff --git a/src/DependentSelectBox/DependentSelectBox.php b/src/DependentSelectBox/DependentSelectBox.php index 014d565..83e3d20 100644 --- a/src/DependentSelectBox/DependentSelectBox.php +++ b/src/DependentSelectBox/DependentSelectBox.php @@ -123,7 +123,11 @@ public function setValue($value, $refreshTree = true) { if($value !== null && !$this->hasEmptyValue() && $this->hasAnyParentEmptyValue()) { throw new LogicException("Cant set value of dependent component when parent have no value ! (Control: '$this->name')"); } - parent::setValue($value); + + if ($value !== null && (string) $value !== '') { + parent::setValue($value); + } + if($refreshTree && !$this->hasEmptyValue()) $this->refresh(false); return $this;