Dependent dropDownList from 1 table

Hi everyone. I have 2 tables with the same structure: -Warehouse[name,model,serial] and -Work[name,model,serial,adress].

I use form for recording data to Work table. I use dropdownLists, that get data from Warehouse. Here is a part of code from the form :


<?php echo $form->dropDownList($model,'Printer_serial', CHtml::listData(Warehouse::model()->findAll(), 'Printer_serial', 'Printer_serial'))?>


<?php echo $form->dropDownList($model,'Printer_name', CHtml::listData(Warehouse::model()->findAll(), 'Printer_name', 'Printer_name'))?>


<?php echo $form->dropDownList($model,'Printer_model', CHtml::listData(Warehouse::model()->findAll(), 'Printer_model', 'Printer_model'))?>

The main problem is next: When i choose one dropdownList, i have to choose other lists manually. And i’m looking for way how record all row from first to second table, or when i choose ‘Printer_serial’, rest columns get data from ‘Printer_serial’ row. I saw an example how to make dependent list, but it was only for data in 2 table.