Show Drop-Down Selected Item Data In Form

Hi All,

How can I display data from database of the selected drop-down item in a form?

I’m trying to display the data in some text-fields that is shown only when an item is selected from the drop-down.

I have the following code in the form:


<?php echo $form->dropDownList($model,'business_id', 

	Business::model()->getBusinessName() + array('addNew'=>'Add New...'), 

	array('onchange'=>"{javascript: 

			    if(this.value =='addNew') {

				addBusiness();

				$('#dialogBusiness').dialog('open'); 

				return false;

			    }

			    else {

                                // a function to get data from the database with the selected value from the drop-down list

				getBusinessPartnerDetails(this.value);


			    }

			}"),

	array('empty'=>'#')); ?>

you will be required to set value for business_id model attribute as like follows,


$model->business_id = 'value of business value'

My apologies, I don’t quite understand what you meant. How does setting the business value going to enable me to extract and display information of the selected drop-down list item? Thanks.