1. Bogdan Savluk
  2. yii-chosen

Commits

Bogdan Savluk  committed 5e65b1e

fixed bug when using as input widget(with model and attribute params)

  • Participants
  • Parent commits 857ad8e
  • Branches default

Comments (0)

Files changed (1)

File Chosen.php

View file
         if (isset($this->htmlOptions['name']))
             $name = $this->htmlOptions['name'];
 
+        if ($this->multiple && substr($name, -2) !== '[]')
+            $name .= '[]';
+
         if (isset($this->model)) {
-            echo CHtml::dropDownList($name, $this->model->{$this->attribute}, $this->data, $this->htmlOptions);
+            echo CHtml::dropDownList($name, CHtml::value($this->model, $this->attribute), $this->data, $this->htmlOptions);
         } else {
             echo CHtml::dropDownList($name, $this->value, $this->data, $this->htmlOptions);
         }