data from controller to model

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

If you use the _form.php subview you need to propagate the variable by specifying it in the renderPartial call.

/Tommy

Spot on mate, thanks heaps!