-
Notifications
You must be signed in to change notification settings - Fork 13
Available Options
Id of the main container for the wizard.
Force use of the bootstrap version in case you have some extension having dependencies on yiisoft\yii2-bootstrap4
even though you are using yiisoft\yii2-bootstrap
on the site overall, since the extension checks for yii2-bootstrap4 first and if it finds it will load the yii2-bootstrap4 assets and having both of the extensions installed the widget will always go for the bootstrap4. although we dont recommend doing that but still there are scenarios wher people are using in this manner and fce layout problems. default value for this option is false
which means widget will detect automatically, you can use the provided constants FormWizard::BS_3
or FormWizard::BS_4
.
if form wizard should be loaded in edit mode. Default value is false
. see wiki for details.
Specify the ActiveForm properties.
Next button label, default value Next
.
Previous button label, default value Previous
.
Finish button label, default value Finish
.
Css classes for the button Next, default btn btn-info
.
The html string for the Next button, defaults to <i class="formwizard-arrow-right-alt1-ico"></i>
.
Css classes for the button Previous, default btn btn-info
.
The html string for the prev icon, defaults to <i class="formwizard-arrow-left-alt1-ico"></i>
.
Css classes for the button Finish, default btn btn-success
.
The Html string for the icon, defaults to <i class="formwizard-check-alt-ico"></i>
.
Css class for Add Row Button default to btn btn-info
The html string for the button default to <i class="formwizard-plus-ico"></i>
Adds a Preview Step as the last step in the form wizard where you can preview all the entered inputs grouped by steps, clicking on any step will navigate to that step for quick edit, it defaults to false
. See Wiki For Code Samples
When using 'enablePreview'=>true
you can customize the classes using the below options.
-
classListGroup (string)
: Css class for the list group defaults to'list-group'
. -
classListGroupHeading (string)
: Css class for the list group heading element, defaults to'list-group-heading'
. -
classListGroupItem (string)
: Css class for the list group item, defaults to'list-group-item-success'
. -
classListGroupBadge (string)
: Css class for the list group badge that displays the input label, defaults to'success'
.
Enables to save and restore an un-saved form to the local storage for later use, defaults to false
.
An array of the steps(array
), the steps can have models dedicated to each step, or a single model for all steps. Following options are recognized when specifying a step.
-
type (string)
: The type of the step, defaults todefault
. This option is used if you need to have tabular inputs for the step by specifying the type astabular
, you can use the provided constants likeFormWizard::STEP_TYPE_TABULAR
orFormWizard::STEP_TYPE_DEFAULT
. -
isSkipable (boolean)
: If current step can be skipped or not, see wiki for details. -
limitRows (int)
: The number of rows to limit the tabular step Add Rows functionality in combination with theFormWizard::STEP_TYPE_TABULAR
, default is unlimited-1
. See Wiki. -
model (object | array of models)
: The\yii\model\ActiveRecord
model object or array of models to create step fields.Note: After the addition of the feature Tabular Steps when using
'type'=>'tabular'
you must remember that you cannot provide different models, although you can provide multiple instances when in edit mode but for the same model only.While adding a new record you can have like below
$addressModel = new Address(); "steps"=>[ [ 'title'=>'Step Title', 'type' => FormWizard::STEP_TYPE_TABULAR, 'model'=> $addressModel ] ]
When in Edit Mode you can provide the multiple instances of
Address
//either using model directly $addressModel = Address::find() ->where( ['=','user_id',Yii::$app->user->id] )->all(); //or using the model relation if you have `getAddress()` defined inside //the `User` model. `$user` has the selected user in code below $addressModel = $user->address; "steps"=>[ [ 'title'=>'Step Title', 'type' => FormWizard::STEP_TYPE_TABULAR, 'model'=> $addressModel ] ]
-
title (string)
: The title of the step to be displayed inside the step Tab. -
description (string)
: The short description for the step. -
formInfoText (text)
: The text to be displayed on the top of the form fields inside the step. -
fieldOrder (array)
: The default order of the fields in the steps, if specified then the fields will be populated according to the order of the fields in the array, if not then the fields will be ordered according to the order in thefieldConfig
option, and iffieldConfig
option is not specified then the default order in which the attributes are returned from the model will be used. -
stepHeadings (array)
: takes a collection of arrays to group step fields under the headings, it accepts arrays with the following keys. Wiki Code Sample-
text (string)
the text to be displayed as the heading. -
before (string)
the field before which you want the heading to appear. -
icon (string)
the markup for the icon like<i class="fa-user"></i>
or the image tag with url you want to display, it defaults to<i class="formwizard-quill-ico"></i>
. If you dont wish to use an icon you can passfalse
.
-
-
fieldConfig (array)
: This option is used mainly to customize the form fields for the step. 3 options are recognized inside thefieldConfig
, 2 of them areexcept
andonly
. See below for the details -
except (array)
: List of fields that should not be populated in the step or should be ignored, for example'fieldConfig'=>[ 'except'=>[ 'created_on','updated_on' ] ]
By default all the attributes that are safe to load value are populated, and the
id
orprimary_key
is ignored by default. -
only (array)
: list of the fields that should be populated for the step, only the fields specified in the list will be available and all other fields will be ignored.Apart from the above options the
fieldConfig
recognizes some special options specific to every field separately when customizing a field, for example'fieldConfig'=>[ 'username'=>[ 'options'=>[ 'class'=>'my-class' ] ] ]
you should specify the field name of the model and its customization settings in form of
name=>value
pairs. The following special options can be used when specifying the form/modelfield_name
.-
options
-
containerOptions
-
inputOptions
-
template
-
labelOptions
-
widget
-
multifield (boolean)
-
hint
-
tabularEvents
(used with the tabular steps) -
persistenceEvents
(effective withenablePersistence
) See Wiki See Wiki For Customizing Fields using options above Details -
options (array)
: You can specify the HTML attributes (name-value pairs) for the field'field_name'=>['options'=>['class'=>'my-class']]`
All those special options that are recognized by the
-
checkbox(), radio()
:uncheck
,label
,labelOptions
-
checkboxList(), radioList()
:tag
,unselect
,encode
,separator
,itemOptions
,item
.
can be used with-in the
options
option. The following 2 options are specially recognized by this widget when used with-in theoptions
.-
type (string)
: The type of the form field to be created, this can betext
,dropdown
,checkbox
,radio
,textarea
,file
,password
,hidden
. Default value for this option istext
. -
itemsList (string/array)
: This option can be used with adropdown
,checkboxList
orradioList
. It is used in combination of the the optiontype
. If you provide theitemsList
an array and use the'type'=>'checkbox'
, it will callcheckboxList()
, and acheckbox()
if you provide string, same goes for the radioList and radio.
-
-
lableOptions (array)
: The HTML and special options for customizing the field label, you can use the following settings-
label (string)
: The label text. -
options (array)
: The HTML attributes (name-value pairs) for the label.
-
-
template (string)
: The template used for the field the default value used is{label}\n{input}\n{hint}\n{error}
. -
containerOptions (array)
: HTML atrtibutes for the cotnainer tag used asname=>value
pairs. -
widget
: This option can be used if you want to use a widget instead of the the default fields, you can specify the widget class name'widget'=>widget::class
, and the options for the widget will be provided in theoptions
option. -inputOptions (array)
: this is same as theinputOptions
used by the ActiveFormfield()
method. -
multifield (boolean)
: a boolean which decides if the field name should consist of an array or not, for example using multi file upload widgets require thename
attribute for the field to be declared as an array likefiled_name[]
instead offield_name
. you can pass this option as true by default it is false. -
hint (string)
: it is used to provide a hint text for the field if you dont provide a custom hint text for any field it will attempt to show the custom hints that are provided inside the model by overriding theattributeHints()
, otherwise it wont show any hint. -
tabularEvents (array)
: it takes an array as an argument with the following valuesbeforeClone
,afterClone
andafterInsert
in the form"eventName"=>"function(event){}"
, see for details-
beforeClone
: Takes a callbackfunction(event){}
used for the PRE processing of the source element before it is cloned, using$(this)
inside the function callback referes to the element in the first rows always. -
afterClone
: Takes a callbackfunction(event){}
used for the POST processing of the source element before it is cloned, using\$(this)
inside the function callback referes to the element in the first rows always. -
afterInsert
: Takes a callbackfunction(event, params){console.log(params)}
used for the POST processing of the newly added element after it is cloned, using$(this)
inside the function callback referes to the newly added row.theparams
is json object which holds therowIndex
.
-
-
persistenceEvents (array)
: it accepts an array of events with the following name. (currently onlyafterRestore
is supported).-
afteRestore
: take a callback as string"function(event,params){}"
to be called for post-restore operations, it provides 2 parametersevent
andparams
where params is a JSON{fieldId: "field_name",fieldValue: "field_value"}
.
-
-
Only the following options of the plugin SmartWizard are allowed to be customized
Name of the theme to be used, there are mainly 6 themes supported by the plugin
-
default
:const THEME_DEFAULT
-
dots
:const THEME_DOTS
-
arrows
:const THEME_ARROWS
-
circles
:const THEME_CIRCLES
-
material
:const THEME_MATERIAL
-
material-v
:const THEME_MATERIAL_V
The effect used when sliding the step it can be one of the
none
slide
fade
Show url hash based on step, default false
.
Enable selection of the step based on url hash, default value is false
.
Position of the toolbar (none, top, bottom, both
), default value top
.
Position of the toolbar buttons (left, right), default value is left.
Specify the extra buttons and its events to show on toolbar.
Make already visited steps as done, default value is true
.
When a step selected by url hash, all previous steps are marked done, default value is true
.
While navigate back done step after active step will be cleared, default value is false
.
Enable/Disable the done steps navigation, default value is true
.
- Get Running with Minimal Options
- Disable ActiveForm Validation
- Enable Ajax Validation
- Add Custom Buttons
- Widget Constants
- Customizing Form Fields
- Configuring File Uploads
- Custom Field Order
- Single Model Across Steps
- Multiple models in a single step
-
Tabular Steps-(New)
- Working With Widgets
- Limiting Rows
- Dependent Inputs Since v1.7.2
- Skip-able Step-(Since v1.5.0)
- Enable Preview Step-(New)
- Group Fields-(New)
- Enable Form Persistence-(New)
- Enable Edit Mode - (Since v1.6.4)