Difference between #2 and #3 of
Creating and updating model and its related models in one form, inc. image

Revision #3 has been created by Boaz on Sep 10, 2012, 9:28:08 AM with the memo:

added flash messages upon success
« previous (#2)

Changes

Title unchanged

Creating and updating model and its related models in one form, inc. image

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

multiple models, one to many, Image upload

Content changed

[...]
$success_saving_all = false;
}

if ($success_saving_all) {
// everything's done. Would you believe it?! Go to 'view' page :)
$success_msg = (count($songs_to_save) > 0) ? "Artist and song records has been created successfully!" : "Artist record has been created successfully!";
 
Yii::app()->user->setFlash('success', Yii::t("MusicModule.forms", $success_msg));
 
$this->redirect(array("view", "id" => $model->id));
}
}
[...]
if ($success_saving_all) {
$success_msg = (count($songs_to_save) > 0) ? "Artist and song records have been updated" : "Artist record have been updated";
 
Yii::app()->user->setFlash('success', Yii::t("MusicModule.forms", $success_msg));
 
$this->redirect(array("view", "id" => $model->id));
}
}
}
else {
// initial rendering of update form. prepare songs for printing.
[...]
6 1
22 followers
Viewed: 100 175 times
Version: 1.1
Category: How-tos
Written by: Boaz
Last updated by: Boaz
Created on: Sep 9, 2012
Last updated: 5 years ago
Update Article

Revisions

View all history