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'); ?>
and
Quote
<?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.