i need to generate multiple activedropdownlist in a for loop or something

i have created ten activedropdownlist and a corresponding textfield for it…when a value from the dropdown is selected i need to display a value in the corresponding textfield how could i do this…

With a JS event on the dropdown list that will be triggered when something is selected/changed in the dropdown list.

i couldnt get u explain me detaily

Could you provide some code? I could probably show an HTML example but if you gave me your code i will be able to maybe take a look at the way it's written and help according to that.



<?php echo CHtml::activeDropDownList($form,'questiontype',$data4,array('prompt'=>'select…','name'=>'questiontype['.$i.']','submit'=>array(''),'params'=>array('name'=>'type['.$i.']','value'=>$form->questiontype))); ?></td>

}how could i get the dropdownlistvalue and display value from database to a textfield…

  • use onchange event to get the changed value for a dropdown and then an ajax request to get the text for the corresponding textfield (all can be done using 'ajax' parameter for each dropdown)

  • on load you need a text field value for the selected option for each dropdown - this to be done in the controller