Revision #48 has been created by glicious on Mar 10, 2016, 12:32:25 AM with the memo:
The empty value for dropDownlist didn't have the closing brackets inside quote.
« previous (#47) next (#49) »
Changes
Title
unchanged
By Example: CHtml
Category
unchanged
Tutorials
Yii version
unchanged
Tags
unchanged
listData, chtml, link, button, ByExample, ajax, ajax link, image
Content
changed
[...]
This example will avoid the dropdownlist to be blank when no value, outputing some proper information to the user
```php
<?php echo CHtml::dropDownList('listname', $select,
array('M' => 'Male', 'F' => 'Female'),
array('empty' => '(Select a gender)'));
```[...]
<?php echo CHtml::dropDownList('listname', $select,
$model->genderOptions,
array('empty' => '(Select a gender')
');
```[...]
echo CHtml::dropDownList('categories', $category,
$list,
array('empty' => '(Select a category')
');
```[...]
CHtml::listData(categories::model()->findAll("Status=1"),
'category_id', 'category_name'),
array('empty' => '(Select a category')
');
```[...]