Fixes #1550: fixed the issue that JUI input widgets did not property input IDs.

This commit is contained in:
Qiang Xue
2013-12-21 17:07:31 -05:00
parent a126419e9e
commit 0ff8518c21
9 changed files with 69 additions and 39 deletions

View File

@@ -9,6 +9,7 @@ Yii Framework 2 Change Log
- Bug #1500: Log messages exported to files are not separated by newlines (omnilight, qiangxue)
- Bug #1509: The SQL for creating Postgres RBAC tables is incorrect (qiangxue)
- Bug #1545: It was not possible to execute db Query twice, params where missing (cebe)
- Bug #1550: fixed the issue that JUI input widgets did not property input IDs.
- Bug #1591: StringValidator is accessing undefined property (qiangxue)
- Bug: Fixed `Call to a member function registerAssetFiles() on a non-object` in case of wrong `sourcePath` for an asset bundle (samdark)
- Bug: Fixed incorrect event name for `yii\jui\Spinner` (samdark)
@@ -24,7 +25,8 @@ Yii Framework 2 Change Log
- Enh: Added `Widget::autoIdPrefix` to support prefixing automatically generated widget IDs (qiangxue)
- Enh: Support for file aliases in console command 'message' (omnilight)
- Enh: Sort and Paginiation can now create absolute URLs (cebe)
- Chg: Renamed yii\jui\Widget::clientEventsMap to clientEventMap (qiangxue)
- Chg: Renamed `yii\jui\Widget::clientEventsMap` to `clientEventMap` (qiangxue)
- Chg: Added `yii\widgets\InputWidget::options` (qiangxue)
- New #1438: [MongoDB integration](https://github.com/yiisoft/yii2-mongodb) ActiveRecord and Query (klimov-paul)
- New #1393: [Codeception testing framework integration](https://github.com/yiisoft/yii2-codeception) (Ragazzo)

View File

@@ -38,10 +38,6 @@ class Captcha extends InputWidget
* The action represented by this route must be an action of [[CaptchaAction]].
*/
public $captchaAction = 'site/captcha';
/**
* @var array HTML attributes to be applied to the text input field.
*/
public $options = [];
/**
* @var array HTML attributes to be applied to the CAPTCHA image tag.
*/
@@ -62,9 +58,6 @@ class Captcha extends InputWidget
$this->checkRequirements();
if (!isset($this->options['id'])) {
$this->options['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
}
if (!isset($this->imageOptions['id'])) {
$this->imageOptions['id'] = $this->options['id'] . '-image';
}

View File

@@ -11,6 +11,7 @@ use Yii;
use yii\base\Widget;
use yii\base\Model;
use yii\base\InvalidConfigException;
use yii\helpers\Html;
/**
* InputWidget is the base class for widgets that collect user inputs.
@@ -40,6 +41,10 @@ class InputWidget extends Widget
* @var string the input value.
*/
public $value;
/**
* @var array the HTML attributes for the input tag.
*/
public $options = [];
/**
@@ -49,7 +54,10 @@ class InputWidget extends Widget
public function init()
{
if (!$this->hasModel() && $this->name === null) {
throw new InvalidConfigException("Either 'name' or 'model' and 'attribute' properties must be specified.");
throw new InvalidConfigException("Either 'name', or 'model' and 'attribute' properties must be specified.");
}
if (!isset($this->options['id'])) {
$this->options['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
}
parent::init();
}

View File

@@ -61,10 +61,6 @@ class MaskedInput extends InputWidget
* @var string a JavaScript function callback that will be invoked when user finishes the input.
*/
public $completed;
/**
* @var array the HTML attributes for the input tag.
*/
public $options = [];
/**
@@ -77,10 +73,6 @@ class MaskedInput extends InputWidget
if (empty($this->mask)) {
throw new InvalidConfigException('The "mask" property must be set.');
}
if (!isset($this->options['id'])) {
$this->options['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
}
}
/**