Heyho
(M8r 21hukg)
June 7, 2013, 9:33am
1
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?
Heyho
(M8r 21hukg)
June 7, 2013, 10:43am
3
<?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?
Heyho:
<?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)); ?>
Heyho
(M8r 21hukg)
June 10, 2013, 9:11am
5
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>
<td style="width:70px;">
<label class="required" style="font-weight:bold;font-size:12px;">Name <span class="required">*</span></label>
<div id="party-name-label" style="display:none;">&nbsp;</div>
</td>
<td style="width:80px;">
<?php echo $form->textField($partyModel,'name', array('style' => 'width:141px;')); ?>
<?php //echo $form->error($partyModel,'name'); ?>
<span style="display:none;" id="Elegal_party_name_em_" class="errorMessage">Name cannot be blank.</span>
</td>
<td id="party-mobile" style="width:107px;">
<label for="ElegalPartiesInfo_mobile" style="font-weight:bold;font-size:12px;">Mobile</label>
<div id="party-mobile-label" style="display:none;">&nbsp;</div>
</td>
<td style="width:80px;">
<?php echo $form->textField($partyModel,'mobile', array('style' => 'width:141px;'));?>
<?php echo $form->error($partyModel,'mobile');?>
<div id="party-mobile-txt" style="display:none;">&nbsp;</div>
</td>
</tr>