From 48363a3644f75f7b28e24f017c1193de22a3b6c4 Mon Sep 17 00:00:00 2001 From: tonydspaniard Date: Fri, 20 Dec 2013 14:02:59 +0100 Subject: [PATCH 1/2] Add active id to options if input widget has a model fixes #1550 --- extensions/yii/jui/InputWidget.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extensions/yii/jui/InputWidget.php b/extensions/yii/jui/InputWidget.php index e100d6c..68334c7 100644 --- a/extensions/yii/jui/InputWidget.php +++ b/extensions/yii/jui/InputWidget.php @@ -10,6 +10,7 @@ namespace yii\jui; use Yii; use yii\base\Model; use yii\base\InvalidConfigException; +use yii\helpers\Html; /** * InputWidget is the base class for all jQuery UI input widgets. @@ -46,6 +47,9 @@ class InputWidget extends Widget if (!$this->hasModel() && $this->name === null) { throw new InvalidConfigException("Either 'name' or 'model' and 'attribute' properties must be specified."); } + if($this->hasModel() && !array_key_exists('id', $this->options)) { + $this->options['id'] = Html::getInputId($this->model, $this->attribute); + } parent::init(); } From 045295e3c6aee2648ab507dc38b5c988aeaa1acf Mon Sep 17 00:00:00 2001 From: tonydspaniard Date: Fri, 20 Dec 2013 14:04:48 +0100 Subject: [PATCH 2/2] Update change log --- extensions/yii/jui/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/yii/jui/CHANGELOG.md b/extensions/yii/jui/CHANGELOG.md index eb30e09..6f3cfb9 100644 --- a/extensions/yii/jui/CHANGELOG.md +++ b/extensions/yii/jui/CHANGELOG.md @@ -4,7 +4,7 @@ Yii Framework 2 jui extension Change Log 2.0.0 beta under development ---------------------------- -- no changes in this release. +- Bug #1550: Ensure active id to options when using models (tonydspaniard) 2.0.0 alpha, December 1, 2013 -----------------------------