event handling for dropdownlist


I want to perform event handling on a dropdownlist.

For example:

  I have a table costing group with columns(id,groupname,blockname,flatname...)

  groupname is a dropdownlist having " groupA, groupB,.."

  Blockname,flatname are also dropdown list but the data comes from other table.

  Now if i select groupA, then only blockname field which is a dropdown must be accessible and Flatname field      which is a dropdown must be deactivated . 

help me please.

I didn’t get very well what you have to achive, anyway you can use the on change js event:

In the dropdownlist use the parameter htmloptions:

CHtml::activeDropDownList($model, 'attribute', array(values), array('onChange'=>'jsfunction'));

In the onChange you can use also ajax request for retrive data from the server.

Thanks for the quick reply. but i did not use ajax.

How can i make a dropdownlist deactivate when i select a value in other dropdownlist?

If first dropdownlist value is "groupA" then second dropdownlist must get activated and third dropdownlist must be deactivated.