yii-joblo / multimodelform

Yii extension multimodelform
13 stars 9 forks source link

Undefined variable: updateItems #6

Closed larry-tx closed 10 years ago

larry-tx commented 10 years ago

When I try to implement your latest version of the extension, on actionCreate, it returns the following error message when attempting to display the form:

Undefined variable: updateItems

This error arises from this section of actionCreate, exactly as it is in your instructions:

$this->render('create', array(
                'model'          => $model,
                'member'         => $member,
                'validatedItems' => $updateItems,
            ));

I've gone through MultiModelForm.php and can't find any reference to $updateItems or anything like it, so I can't figure out how this should be corrected. I've tried 'validatedItems => $validatedItems, but that just returns the error Undefined variable: validatedItems.

Can you give me any help on this?

yii-joblo commented 10 years ago

This is not an issue of the multimodelform. This is part of the actionCreate of the controller. Please see the docs of the extension here: http://www.yiiframework.com/extension/multimodelform/ -> actionCreate

larry-tx commented 10 years ago

I see the issue now. You have three different render statements for actionCreate in three different places.

On yiiframework.com (http://www.yiiframework.com/extension/multimodelform/):

 $this->render('create',array(
        'model'=>$model,
        //submit the member and validatedItems to the widget in the edit form
        'member'=>$member,
        'validatedMembers' => $validatedMembers,
    ));

on Github.com (https://github.com/yii-joblo/multimodelform)

$this->render('create',array(
        'model'=>$model,
        'member'=>$member,
        'errorIndexes' => $errorIndexes,
        'validatedItems' => $updateItems,
    ));

In the readme.txt file with the extension:

$this->render('create',array(
        'model'=>$model,
        'member'=>$member,
        'errorIndexes' => $errorIndexes,
        'validatedItems' => $updateItems,
    ));

I had followed the one on GitHub, and it doesn't work. You might want to update your instructions on the other two.

Thanks for a fantastic extension. Other than the little glitch in the instructions, it works perfectly! I've tried doing what it does on my own and realize how very complicated the process is. You've certainly accomplished in a far better way than I was able to do.