Difference between #47 and #48 of
By Example: CHtml

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
')');
```
[...]
79 0
74 followers
Viewed: 993 811 times
Version: 1.1
Category: Tutorials
Written by: jonah
Last updated by: glicious
Created on: Sep 25, 2009
Last updated: 8 years ago
Update Article

Revisions

View all history