Revision #6 has been created by kiran sharma on Aug 3, 2012, 9:24:16 AM with the memo:
comment added
« previous (#5) next (#7) »
Changes
Title
unchanged
How to use Multiple instances of the same model in the same form
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
Multiple instances of the same model in the same form, Multiple instances of the same model, Two instances of the same model
Content
changed
[...]
{
$addressModel_1->attributes=$_POST['Address'][1]; // Set attribute for home address
$addressModel_2->attributes=$_POST['Address'][2]; // Set attribute for company address
$model->attributes=$_POST['User']; // Set attribute for user data
$valid=$addressModel_1->validate(); // Validate all three model
$valid=$addressModel_2->validate() && $valid;
$valid=$model->validate() && $valid;[...]
$model->attributes=$_POST['User']; // Set attribute for user data
$valid=$addressModel_1->validate(); // Validate all three model
$valid=$addressModel_2->validate() && $valid;
$valid=$model->validate() && $valid;
if($valid)
{[...]