Difference between #10 and #11 of
How to use a single form to collect data for two or more models?

Revision #11 has been created by JimJ on Jun 18, 2011, 6:13:58 PM with the memo:

Added note about create.php edit
« previous (#10) next (#12) »

Changes

Title unchanged

How to use a single form to collect data for two or more models?

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

model validation

Content changed

[...]
'b'=>$b,
));
}
```

To add these new fields to your Create form, add your 2nd table fields
.  This is usually no stored in a 2nd model.  
 
 
A's create.php:
 
 
 
 
 
```php 
<?php echo $this->renderPartial('_form', array('a'=>$a, 'b'=>$b)); ?>
 
```
 
 
 
You usually place the specific fileds in
the _form.php file if you are working off Gii created CRUD files.


```php
<?php echo CHtml::beginForm(); ?>
[...]
88 0
79 followers
Viewed: 332 147 times
Version: 1.1
Category: Tutorials
Written by: qiang
Last updated by: Yang He
Created on: Feb 27, 2009
Last updated: 11 years ago
Update Article

Revisions

View all history