beastbytes / yii2-wizard

Yii2 Extension to handle multi-part form wizards
Other
37 stars 21 forks source link

I use example, but return empty page #17

Open dimgolsh opened 5 years ago

dimgolsh commented 5 years ago

I use example, but return empty page


   public function quizWizardStep($event)
    {
        $modelName = 'app\models\wizard\quiz\Question';
        $model = new $modelName(['question' => $this->questions[$event->n]]);
        $t = count($this->questions);
        debug($model);
        if ($model->load(Yii::$app->request->post()) && $model->validate()) {
            $event->data     = $model;
            $event->nextStep = ($event->n < $t - 1
                ? WizardBehavior::DIRECTION_REPEAT
                : WizardBehavior::DIRECTION_FORWARD
            );
            $event->handled  = true;
        } else {

            $event->data = $this->render('quiz\question', compact('event', 'model', 't'));

        }

    }
    public function actionQuiz($step = null)
    {
        //if ($step===null) $this->resetWizard();
        return $this->step($step);
    }

perhaps the page does not return if to output a variable $event->data , it contains the page code

dimgolsh commented 5 years ago

Bag in $config['bootstrap'][] = 'debug'; Work, if comment debug

if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
  //  $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
        // uncomment the following to add your IP if you are not connecting from localhost.
        //'allowedIPs' => ['127.0.0.1', '::1'],
    ];
mariodro commented 5 years ago

Temporal fix:

public function beforeAction($action) { 
    \yii\base\Event::off('*', '*');
    return parent::beforeAction($action);
}
php5developer commented 5 years ago

I would suggest not to disable all events, but to disable only "Event Panel" in debug panel.


    $config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
        'panels'=>[
            'event'=>false,
        ]
    ];