The Wizard allows you to guide user through the form step by step.
To continue to next step, user must fill all required fields first. Add as many steps as necessary:
This page contains a detailed description of the container properties and JavaScript samples that you can use with this container.
Here you can find properties specifically related to the Wizard container.
A unique identifier for the container.
JavaScript
The Name property allows to work with the container via JavaScript code, like this:
fd.spRendered(function(){
//hide container
fd.container('Wizard1').hidden = true;;
});
Allows you to choose the shape and appearanace of each step in the Wizard: Circle, Square, Tab. Default is circle.
The options look like this:
Circle:
Square:
Tab:
The property defines the text of the Back button which switches users to the previous step.
This property holds JavaScript code of the Finish button. By default, the code is set to submit the form.
The property defines the width of the container in pixels.
If left blank, the container takes up the entire available width in the current grid cell.
In this section, you can find basic examples of how to work with the containers using JavaScript.
If you are not familiar with the JavaScript framework, get started with the JavaScript basics.
Note
The container is only accessible once the form is rendered, so all calls to the containers must be inside fd.spRendered event:
fd.spRendered(function(){
//hide the container
fd.container('Container1').hidden = true;
//show the container
fd.container('Container1').hidden = false;
});
Access HTML element inside the container.
//access container's HTML var htmlcontainer = fd.container('Container1').$el;
Hide a container from a user.
//hide container fd.container('Container1').hidden = true; //show container fd.container('Container1').hidden = false;
Get or set text on the Back/Next/Finish buttons:
//returns string
var back = fd.container('Container1').backText;
var next = fd.container('Container1').nextText;
var finish = fd.container('Container1').finishText;
fd.container('Container1').backText = 'Return';
fd.container('Container1').nextText = 'Forward';
fd.container('Container1').finishText = 'Complete';
Property that holds the Shape of the UI icons, can be used to get it or set it.
If the value set is incorrect, shape reverts to Circle.
//returns string
fd.container('Container1').shape;
fd.container('Container1').shape = 'circle';
fd.container('Container1').shape = 'square';
fd.container('Container1').shape = 'tab';
Reset the state of the Wizard, and bring user to the first step:
//resets the Wizard
fd.container('Container1').widget.reset();
The property holds steps of the wizard as an array of objects. Can be used to hide/show steps or change their order.
//get an array of steps
fd.container('Container1').widget.tabs;
//switch places for steps 1 and 2
var tabs = fd.container('Container1').widget.tabs;
fd.container('Container1').widget.tabs = [tabs[1], tabs[0], tabs[2], tabs[3]];
fd.container('Container1').widget.reset();
Gets the index of the currently selected step:
//returns integer
var currentStepIndex = fd.container('Container1').widget.activeTabIndex;
Hide a step based on condition. In this example, we hide Resolved step and show it only when the issue status is set to ‘Resolved’ using this code:
//store the step in a variable
var secondStep = fd.container('Container1').widget.tabs[1];
//hide the step by removing it
fd.container('Container1').widget.tabs.splice(1, 1);
//add the step back
fd.container('Container1').widget.tabs.splice(1, 0, secondStep);
The property holds names of the steps of the wizard as an array of strings. Can be used to get/set step titles.
//returns array of strings
fd.container('Container1').steps;
fd.container('Container1').steps = ['Step 1', 'Step 2', 'Step 3'];
Property that holds an array of Microsoft Fabric Icons for each step, can be used to get it or set them.
By default each step is represented by a number, but this can be changed.
//returns array of strings
fd.container('Container1').icons;
fd.container('Container1').icons = ['BoxCheckmarkSolid', 'BoxAdditionSolid', 'BranchSearch'];
This method opens a specific step. The step must be activated. Triggers validation.
//opens the second step
fd.container('Container1').widget.navigateToTab(1);
//opens next step
var currentStepIndex = fd.container('Container1').widget.activeTabIndex;
fd.container('Container1').widget.navigateToTab(currentStepIndex + 1);
This method navigates from one step to another. Doesn’t trigger validation.
//opens the third step
fd.container('Container1').widget.changeTab(0,2);
By default, user can only go to steps which they’ve been to before, but this code makes all steps clickable and openable.
//make all steps clickable
fd.container('Container1').widget.activateAll();
An event that is triggered when a user switches between steps. Allows you to customize behavior on step change, for example, skip steps.
//detect change, and get the index of previous and current step
fd.container('Container1').widget.$on('on-change', function(prevIndex, newIndex) {
alert('Previous step: ' + prevIndex);
alert('Current step: ' + newIndex);
});
//skip the second step
fd.container('Container1').widget.$on('on-change', function(prevIndex, newIndex) {
if (prevIndex === 0) {
window.setTimeout(function() {
fd.container('Wizard1').widget.navigateToTab(2);
}, 100);
}
});
An event that is triggered on the Finish button click.
fd.container('Container1').widget.$on('on-complete', function() {
alert('Wizard steps are completed!');
});