问题
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