I write a drop down list populated from values of another model
<?php echo $form->dropDownList($model,'idcausale_uscita', CHtml::listData(CausaleUscita::model()->findAll(), 'idcausale_uscita', 'uscita')); ?>
Is it possible to change the value of another textfield, in the same form, accordling the value of dropdownlist chosen? I can't figure out... maybe with onchange event?
$model,'idcausale_uscita' is the first model and refer to current form. The second 'idcausale_uscita' (not a good idea give it the same name...), 'uscita' are the values populating dropdownlist of another model.
The table with data to select are very simple:
id – description – nvalue
0 – aaa – 10
1 – bbb – 12
2 – ccc – 5
… and so on
I need to select from description field (and this work), and put in another textfield the corrisponding “nvalue”. And this I can't figure out.
Thank you in advance