dependent dropdowns

Well i know this topic is discussed much on these forums but i want some smart way to handle this.Any help will be appreciated

I have 2 drop downs

1 - Make

2 - Model

Model is dependent on Make.When i changed Make ,related Models drop down populated fine.

Now when i submit form and there are some errors control comes back on same page with error messages.All Data remains same but Model drop down gone empty.

Is there any smart method to keep Model drop down data available?

Is there any extesion?


i have to write some custom code

Thnks in advance

I did it like this:

Car Model:

public function getCarMakes()


	return isset($_POST['Car']['model']) ? CHtml::listData($this->findAll(), 'id', 'name') : array();



<?php echo CHtml::activeDropDownList($model, 'make', Car::model()->carMakes); ?>

Take also a look at this article.

@zaccaria, i started to built drop downs from that article.I think you did not read my request in detail.

@GSTAR gave valid answer to my request

Any how Thanks for both of you

Sorry, I read your request but didn’t guess that you read the article.

Did you solved your issue?

Yeah Thanks

My problem solved

I am doing coding in php for last 6 years

And Now Thinking why i did not start yii early?

I am thankful to yii and its team

Helper Masters like you

Thanks all