attribute dependance


I’ve a problem but I don’t know if it is a misconception or other thing…

I have a model in which I have 2 attributes, which are linked together.

A model “Car” belongs to a brand(for instance a car is a “Audi”),and a car belongs to a “model” (not a php model, but a car’s model (don’t know the word in english) for instance a car is a “A3”). A model belongs also to a brand (for instance the “A5” model belongs to “Audi”)

My problem is for the creation of the Car

in my form i have a dropdownList for knowing all Car’s brand.

In the process of building the car, I choose first, the brand of the car Then I would like to have in the dropdownList the "model" belonging to the chosen brand.

for instance I choose for my car a brand : "Audi" then when I have to choose th e"model" I would like to have only the "model" belonging to "Audi" brand, and not the ones belonging to "Bmw" or somewhat else

Is there a way to do that ?

Because without using javascript I can’t know the chosen brand before posting the data…


If i understand ,you need a dynamic dropdownlist brand,update second dropdown model of car


Thanks, I did know about "dynamic" dropdown.

I will go further on this topic

Yes , we need an example about it by Yii.

There is something in the wiki

Wiki example

Something that I do not uderstand in the code of the example is the use of CControler::createLink, This syntax implies that createLink is a static method whereas if we see the code it is not…

I have an error about it.