Difference between #3 and #4 of
How to create/save more Model inputs and make them repeatable with jQuery

Revision #4 has been created by StErMi on Apr 30, 2009, 8:17:21 AM with the memo:

Added save(false) and CUploadedFile::getIstance()
« previous (#3) next (#5) »

Changes

Title unchanged

How to create/save more Model inputs and make them repeatable with jQuery

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

Content changed

[...]
// This is the crappy part of the script that I need to improve and make it more elegance
// I've to add to the photoEvent array a new PhotoEvent for every istance in $_POST['PhotoEvent']
foreach ( $_POST['PhotoEvent'] as $i => $photo ) {
$photosEvent[$i] = new PhotoEvent;
if ( isset( $_POST['PhotoEvent'][$i] ) )
$photosEvent[$i]->
attributes = $_POST['PphotoUrl = CUploadedFile::getIstance($photosEvent'][$i];         , "photoUrl[$i]" ); $valid = $valid && $photosEvent[$i]->validate(); } if( $valid && $event->save(false) ) {
Yii::import('application.extensions.image.Image');
// Saving each period ( i've to change the date format couse in Italy we use dd/mm/yyyy
[...]
$image->save();
*/
$photo->save(
false);
}


$this->redirect(array('show','id'=>$lastminute->id));
[...]
11 0
16 followers
Viewed: 52 294 times
Version: 1.1
Category: Tutorials
Tags:
Written by: qiang
Last updated by: Yang He
Created on: Apr 21, 2009
Last updated: 12 years ago
Update Article

Revisions

View all history