jacbmw
(Jacobpfield)
1
Basically loading relational data (One Venue has one Address)
In Controller:
[indent]$model=$this->loadvenue();
$address=address::model()->findByAttributes(array(‘venueId’=>$model->id));
…
$this->render(‘update’,array(‘model’=>$model, ‘address’=>$address));[/indent]
In view:
[indent]<?php echo CHtml::activeTextField($model,‘website’,array(‘size’=>60,‘maxlength’=>145)); ?>
<?php echo CHtml::activeTextField($address,‘unit’,array(‘size’=>60,‘maxlength’=>145)); ?>
[/indent]
Getting following error when trying to view the update view for Venue:
Undefined variable: address
cheers, Jake
tri
(tri - Tommy Riboe)
2
If you use the _form.php subview you need to propagate the variable by specifying it in the renderPartial call.
/Tommy
jacbmw
(Jacobpfield)
3
Spot on mate, thanks heaps!