无法实现 Yii2 向导 [英] Unable to implement Yii2 wizard

查看:31
本文介绍了无法实现 Yii2 向导的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的 yii2 项目中实现向导,但没有成功.我有一个创建表单,我想将其制作为多步表单 类似于此,我在 yii2 中尝试了 这个扩展,它只适用于

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' => '这是第一步'

'content' => 'This is step 1'

但我想改为使用 Activefields.有谁知道如何使它工作?

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); ?>

推荐答案

您需要通过控制器发送表单.

You need send forms through the controller.

示例:

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

创建视图:

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

这篇关于无法实现 Yii2 向导的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆