Dropdowns

SCRIPT for DROPDOWN:




Yii::app()->clientScript->registerScript('filter', "

	

	$('#filter_form').submit(function(event) {

	event.preventDefault();

	$('#HiflashQuotation_project_id').change();

	});

	

    $('#HiflashQuotation_project_id').change(function(event){

		var project = $('#HiflashQuotation_project_id').val();

                

		var form = $('#filter_form');

		var msg = '';

		if(project!='')

		{

		  var a = $(this).attr('HiflashQuotation_project_id');

                  var fields = $('#HiflashQuotation_project_id').attr('field');

                  alert(fields);

                  var results = 'projectname' + a;

                  $('#' + results).text('new results');

                  msg='project';

		}

        

		if(msg=='Select Projects')

		{

            

			$.fn.yiiGridView.update('quotation-grid', {

		          data: $(this).serialize()

            });

	               return false;

			

		}

        

		else

		{

            

			$.fn.yiiGridView.update('quotation-grid', 

					{

						type:'GET', 

						url:'".Yii::app()->createUrl('HiflashQuotation/admin')."', 

						data: form.serialize()

                        

                     

					}); 

			return false;

		}

		});

    ",CClientScript::POS_READY);



DROPDOWN :




<form id="filter_form" onsubmit="return false;"> 

<?php echo CHtml::DropDownList('HiflashQuotation[project_id]', '', CHtml::listData(HiflashProjects::model()->findAll(), 'id', 'project_name'), array('empty'=>'Select Projects','style'=>'width:150px;'), array(array('class' => 'myDropDown'))); ?>

        <div id="projectname">

        </div>

        </form>



can you show me step by step to use dropdownlist which use data from database?

thanks