Update Not Rendering Data From Related Tables/models

Am I supposed to do something special to make this work? the call


        $this->render('update',

                      array('model'=>$model,)

            );

displays the form okay, but there is no data in the fields even though I can see that the model contains data from both the table in question and related tables.

The view does show the data from the "main" model however.

can you paste the view file code?


<?php

/* @var $this ContactController */

/* @var $model Contact */


$this->breadcrumbs=array(

    ' Contacts'=>array('index'),

    $model->id=>array('view','id'=>$model->id),

    'Update',

);


$this->menu=array(

    array('label'=>'List Contact', 'url'=>array('index')),

    array('label'=>'Create Contact', 'url'=>array('create')),

    array('label'=>'View Contact', 'url'=>array('view', 'id'=>$model->id)),

    array('label'=>'Manage Contact', 'url'=>array('admin')),

);

?>


<h1>Update Contact <?php echo $model->id; ?></h1>


<?php echo $this->renderPartial('_form', array('model'=>$model)); ?>



Hi

In the _form file r u using the correct naming on controls?

can you paste the code for _form also?

What do you mean "correct naming"?

each control should be property mapped to the model,

for example in the _form.php file

if this was the model

$partyModel = new ElegalPartiesInfo;

the code to map the control will be done as below

echo $form->textField($partyModel,‘name’, array(‘style’ => ‘width:141px;’));

full code.,

<tr>

        &lt;td style=&quot;width:70px;&quot;&gt;


            &lt;label class=&quot;required&quot; style=&quot;font-weight:bold;font-size:12px;&quot;&gt;Name &lt;span class=&quot;required&quot;&gt;*&lt;/span&gt;&lt;/label&gt;


            &lt;div id=&quot;party-name-label&quot; style=&quot;display:none;&quot;&gt;&amp;nbsp;&lt;/div&gt;


        &lt;/td&gt;


        &lt;td style=&quot;width:80px;&quot;&gt;


            &lt;?php echo &#036;form-&gt;textField(&#036;partyModel,'name', array('style' =&gt; 'width:141px;')); ?&gt;


		    &lt;?php //echo &#036;form-&gt;error(&#036;partyModel,'name'); ?&gt;


		    &lt;span style=&quot;display:none;&quot; id=&quot;Elegal_party_name_em_&quot; class=&quot;errorMessage&quot;&gt;Name cannot be blank.&lt;/span&gt; 


        &lt;/td&gt;


        &lt;td id=&quot;party-mobile&quot; style=&quot;width:107px;&quot;&gt;


        


            &lt;label for=&quot;ElegalPartiesInfo_mobile&quot; style=&quot;font-weight:bold;font-size:12px;&quot;&gt;Mobile&lt;/label&gt;


            &lt;div id=&quot;party-mobile-label&quot; style=&quot;display:none;&quot;&gt;&amp;nbsp;&lt;/div&gt;


           


        &lt;/td&gt;


        &lt;td style=&quot;width:80px;&quot;&gt;


            &lt;?php echo &#036;form-&gt;textField(&#036;partyModel,'mobile', array('style' =&gt; 'width:141px;'));?&gt;


		    &lt;?php echo &#036;form-&gt;error(&#036;partyModel,'mobile');?&gt;


		    &lt;div id=&quot;party-mobile-txt&quot; style=&quot;display:none;&quot;&gt;&amp;nbsp;&lt;/div&gt;


        &lt;/td&gt;


    &lt;/tr&gt;