Unable to implement Yii2 wizard

孤人 提交于 2019-12-12 04:30:45

问题


I am trying to implement wizard in my yii2 project with no luck. I have one create form which i want to make as multi-step form similar to this, I have tried this extension in yii2 it works only with

'content' => 'This is step 1'

but I want to have Activefields instead. Does anyone know how to make it work??

<?php
$wizard_config = [
    'id' => 'stepwizard',
    'steps' => [
        1 => [
            'title' => 'Step 1',
            'icon' => 'glyphicon glyphicon-cloud-download',
            'content' => $form->field($model, 'door_no')->textInput() ,
            'skippable' => false,
            'buttons' => [
                'next' => [
                    'title' => 'Forward', 
                    'options' => [
                        'class' => 'disabled'
                    ],
                 ],
             ],
        ],
        2 => [
            'title' => 'Step 2',
            'icon' => 'glyphicon glyphicon-cloud-upload',
            'content' => '<h3>Step 2</h3>This is step 2',
            'skippable' => true,
        ],
        3 => [
            'title' => 'Step 3',
            'icon' => 'glyphicon glyphicon-transfer',
            'content' => '<h3>Step 3</h3>This is step 3',
        ],
    ],
    'complete_content' => "You are done!", // Optional final screen
    'start_step' => 1, // Optional, start with a specific step
];
?>

<?= \drsdre\wizardwidget\WizardWidget::widget($wizard_config); ?>

回答1:


You need send forms through the controller.

Example:

controller =
'content' => $this->renderPartial('xxx', ['model'=> $model , 'model2'=>
             $model2, 'model3'=>$model3 ,'xxxx'=> $xxxx,'xx'=> $xx, 'xxx'=>$xxx, ]),])

Create the view:

$this->render('_form3', [
        'content' => $content,
        'model3' => $model3,
        'model' => $model,
        'content' => $content
    ])
_form =  $form->field($model, 'door_no')->textInput() ,


来源:https://stackoverflow.com/questions/42808416/unable-to-implement-yii2-wizard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!