Changing Dropdownlist For Readonly When Editing


I’m new, coming from CaVisualObjects,

The question is I’m trying change an external related field creating combo when inserting a new register by a readonly textfield when editing existing.

The trouble is coding the else statement of the IF isnewrecord sentence.

I think code lines explain it better than my english:

<?php if($model->isNewRecord)

     {echo &#036;form-&gt;dropDownListRow(&#036;model, 'genorganizacion_id',             CHtml::listData(Genorganizacion::model()-&gt;findAll(), 'id',    Genorganizacion::representingColumn()));}

  [color=&quot;#FF0000&quot;] else{echo CHtml::encode(&#036;data-&gt;genorganizacion-&gt;nombre); }?&gt;[/color]

This code works well when creating new records but editing (else sentence), because it renders nothing when editing

What 'd be the solution?



I found no error on this code to my knowledge use $model instead of $data in else Part

not clear !!

It works fine.

Many many thanks.