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.[...]
### Links
[Chinese version](http://projects.ourplanet.tk/node/94Ajax Validation Version](http://www.yiiframework.com/wiki/218/how-to-use-single-form-to-collect-data-for-two-or-more-models-cactiveform-and-ajax-validation-edition/)