event handling

i have created two dropdowns in my view without any database.when i select a value in one dropdown other dropdowns value must populate.how to do that event handling in yii.please help me.

Since there is no db, then if I am not wrong, you must use javascript(jquery) in this case.

something like :


$('#select-1').change(function(){

    $('#select-2').append('<option value="0">option1</option>');

    $('#select-2').append('<option value="1">option2</option>');

    ...

});

CMIIW

how should we give names for the dropdowns that we have in our form?

the name should be given when you write the code in view fileā€¦


<?php

echo CHtml::dropDownList('select-1', 0, array());

echo CHtml::dropDownList('select-2', 0, array());

?>