Show/Hide control on dropdown selection

Hi guys, im new to yii and to php so i hope u guys can help me in a simple thing i want to do :)

i have a table of downloadablecategory which has this data






i also have a downloadable table that has the following columns

down_id --------down_title------down_url------dcat_id

where dcat_id refers to the primary key in downloadablecategory

I am using gii for CRUD and Model generation, in the form for creating a new downloadable i added a dropdownlist that is populated from the downloadablecategory table.

<?php echo $form->dropDownList($model,'dcat_id', CHtml::listData(DownloadableCategory::model()->findAll(), 'dcat_id', 'dcat_name')); ?>

what i want to do is according to the users selection in this dropdown i need to check if the downloadablecategory he selected has "ismedia" true or false. If "ismedia" is true i need to show a textbox where he can post the url for video or audio file (like on youtube) or if "ismedia" is false i want to show a fileupload control so he can browse his file system and upload a file.

I hope i was able to explain what i need to do correctly, thanks :)