By Example: CHtml

Comparing #47 with #48

Revision #48 was created by glicious glicious on Mar 10, 2016, 12:32:25 AM.

The empty value for dropDownlist didn't have the closing brackets inside quote.

Content

[...]
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
')');
```
[...]