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

Revision #9 has been created by qiang on May 5, 2011, 7:00:24 AM with the memo:

clean up the create view
« previous (#8) next (#10) »

Changes

Title unchanged

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

Category unchanged

Tutorials

Yii version unchanged

Tags changed

model validation

Content changed

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

And
forin the `create` view, we would needrite the following code, ```php <?php echo CHtml::fbeginForm(); ?> //create.php
 
<?php echo $this->renderPartial('_form', array('a'=>$a,'b'=>$b)); ?>
 
// _form.php
 

 
    
<?php echo CHtml::errorSummary(array($a,$b)); ?>     ...input fields for $a, $b... </form?php echo CHtml::endForm(); ?>
```

The above approach can also be used if we have more than two models to deal with.

### Links
[...]
88 0
79 followers
Viewed: 353 734 times
Version: 1.1
Category: Tutorials
Written by: qiang
Last updated by: Yang He
Created on: Feb 27, 2009
Last updated: 12 years ago
Update Article

Revisions

View all history