Chained Combobox

I have 3 dropDownLists (father, son, grandson) and I need to use ajax to fill each dropDown. I used this…

<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/assets/jquery.chainedSelects.js'); ?>



<?php Yii::app()->clientScript->registerScript('0', '$(function() { $(\'#country\').chainSelect(\'#state\',\''.Yii::app()->request->baseUrl.'/assets/combobox.php\', { before:function (target) { $("#loading").css("display","block"); $(target).css("display","none"); }, after:function (target) { $("#loading").css("display","none"); $(target).css("display","inline"); } }); $(\'#state\').chainSelect(\'#city\',\''.Yii::app()->request->baseUrl.'/assets/combobox.php\', { before:function (target) { $("#loading").css("display","block"); $(target).css("display","none"); }, after:function (target) { $("#loading").css("display","none"); $(target).css("display","inline"); } }); });'); ?>

This works fine, but is too much code to do something relatively simple!

Basically what I need is some way to do exactly this whitout preoccupy with details how this will work in new or edit views.

Detail: ChainedSelects is one script jQuery to solve the problem of dependency, where we have more than 2 combobox.

This should be created as a widget so that you can reuse it easily in different places.

Ok, I will try this.

If someone wants help…

Tks qiang!

This post was moved to [EXTENSIONS]: http://www.yiiframew…pic,1082.0.html