34k+
News
Guide
API
Wiki
Forum
Community
Places
Members
Hall of Fame
Badges
More
Learn
Books
Resources
Develop
Download Yii
Extensions
Report an Issue
Report a Security Issue
Contribute to Yii
Donate
About
Release Cycle
License
Team
Official Logos and Design
Login
Creating a dependent dropdown
Comparing
#13
with
#14
Revision #14 was created by
Paul_Kish
on Dec 3, 2014, 10:57:41 AM.
changed the second parameter of dropdownList() from '' to an empty array() since an empty string causes an error
« Previous (#13)
Next (#15) »
Content
[...]
The view with the form.
-----------------------
We'll show a form that shows countries and dependent of the country selected will show cities.
```php
echo CHtml::dropDownList('country_id',
''
array()
, array(1=>'USA',2=>'France',3=>'Japan'),
array(
'ajax' => array(
'type'=>'POST', //request type
'url'=>CController::createUrl('currentController/dynamiccities'), //url to call.
//Style: CController::createUrl('currentController/methodToCall')
[...]