How to implement (2 dependent select's)

There is a table "table" with fields id, parentid, title

records:

id parentid title

1 0 audi

2 0 bmw

3 0 mersedes

4 1 A4

5 1 A8

6 3 S600

7 3 W220

how to do so when selecting records with parentid = 0 in one select, another updated and select it to display records with parentid = id

1 select: brand

2 select: model

if you select in the list of brand, the second select to renew the values that belong to that brand (by parentid)

http://www.yiiframework.com/doc/cookbook/24/

This example does not work.

Is there other working example?