Cannot Fill a multiple textfield based dropdownlist Yii

Hello,

I have one a table, the name table is ‘siswa’, and has primary Key ‘nim’ and other field ‘nama’,‘alamat’,‘tanggal_lahir’ and other. I want to fill all fieldtext base dropdownlist in Yii framework. with my code is shown/updated with one textfield only, I want populate all textfield. For context table like here

Siswa

Nim | Nama |Alamat | Tanggal_lahir |

12345 Backtrack Maria. St 25-09-1989

Here my view form_ code :


<?php

Yii::app()->clientScript->registerScript("combo-change", "

    $(document).ready(function(){

        $('#nim').change(function(){

        sel = $(this);

        console.log(sel.val());

            if(sel.val() != '' ){

                $('#Siswa_nama').val(sel.val());

                $('#Siswa_nama').attr('disabled', 'disabled');


                $('#Siswa_alamat').val(sel.val());

                $('#Siswa_alamat').attr('disabled', 'disabled');

                                }

        });

    });

");

?>

<?php $SiswaArray = CHtml::listData(Siswa::model()->findAll(array(

    //'order'=>'nama ASC',

    //'group' => 'kelas',

    //'distinct' => true

)),'nama','nim');

?>


<?php echo $form->dropDownList($model, 'nim', $SiswaArray,   array('class'=>'span3', 'empty' => '-- select NIM --', 'id' => 'nim')); ?>


<div class="row">

    <?php echo $form->labelEx($model,'nama');?>

    <?php echo $form->textField($model,'nama', array('class'=>'span2', 'id' => 'Siswa_nama', 'placeholder'=>'nama')); ?>

       </div>

<div class="row">

<?php echo $form->labelEx($model,'Alamat');?>

<?php echo $form->textField($model,'alamat', array('class'=>'span3',   'id' => 'Siswa_alamat', 'placeholder'=>'alamat')); ?>


</div>



Nama and Alamat has been changed, but Alamat is changed same as value field ‘NAMA’ on the table. The table is has NIM, NAMA and Alamat Field. So for output above image, NIM from dropdown 12345, then ‘NAMA’ is “backtrack”, the Alamat should be an street address, such as “bla bla bla.St”. Attached the result.

Thank You,

Can you please specify from where you get the data of populate the textfield, from dropdown value?? or how??

you may have to use some ajax to get data from controller and than load in the fields, I am not sure that there will be a direct way to do the same.